Permalink
Browse files

The directories containing the wxWidgets 2.8 branch are not needed un…

…der git, so remove them.
  • Loading branch information...
1 parent 46ddcca commit 8911d0aaf9ab137831df9a52b66113b0686e0b1e @jodonoghue committed Apr 18, 2012
Showing with 0 additions and 19,842 deletions.
  1. +0 −4 wx-2.8/Setup.lhs
  2. +0 −573 wx-2.8/license.txt
  3. +0 −60 wx-2.8/src/Graphics/UI/WX.hs
  4. +0 −344 wx-2.8/src/Graphics/UI/WX/Attributes.hs
  5. +0 −388 wx-2.8/src/Graphics/UI/WX/Classes.hs
  6. +0 −1,286 wx-2.8/src/Graphics/UI/WX/Controls.hs
  7. +0 −82 wx-2.8/src/Graphics/UI/WX/Dialogs.hs
  8. +0 −219 wx-2.8/src/Graphics/UI/WX/Draw.hs
  9. +0 −334 wx-2.8/src/Graphics/UI/WX/Events.hs
  10. +0 −179 wx-2.8/src/Graphics/UI/WX/Frame.hs
  11. +0 −43 wx-2.8/src/Graphics/UI/WX/Layout.hs
  12. +0 −106 wx-2.8/src/Graphics/UI/WX/Media.hs
  13. +0 −661 wx-2.8/src/Graphics/UI/WX/Menu.hs
  14. +0 −74 wx-2.8/src/Graphics/UI/WX/Timer.hs
  15. +0 −152 wx-2.8/src/Graphics/UI/WX/TopLevelWindow.hs
  16. +0 −144 wx-2.8/src/Graphics/UI/WX/Types.hs
  17. +0 −33 wx-2.8/src/Graphics/UI/WX/Variable.hs
  18. +0 −438 wx-2.8/src/Graphics/UI/WX/Window.hs
  19. +0 −57 wx-2.8/wx.cabal
  20. +0 −573 wxcore-2.8/LICENSE
  21. +0 −103 wxcore-2.8/Setup.hs
  22. +0 −117 wxcore-2.8/src/cpp/apppath.cpp
  23. +0 −1,713 wxcore-2.8/src/cpp/defs.cpp
  24. +0 −115 wxcore-2.8/src/cpp/dragimage.cpp
  25. +0 −55 wxcore-2.8/src/cpp/eljaccelerator.cpp
  26. +0 −77 wxcore-2.8/src/cpp/eljartprov.cpp
  27. +0 −204 wxcore-2.8/src/cpp/eljbitmap.cpp
  28. +0 −105 wxcore-2.8/src/cpp/eljbrush.cpp
  29. +0 −32 wxcore-2.8/src/cpp/eljbusyinfo.cpp
  30. +0 −81 wxcore-2.8/src/cpp/eljbutton.cpp
  31. +0 −202 wxcore-2.8/src/cpp/eljcalendarctrl.cpp
  32. +0 −71 wxcore-2.8/src/cpp/eljcaret.cpp
  33. +0 −26 wxcore-2.8/src/cpp/eljcheckbox.cpp
  34. +0 −31 wxcore-2.8/src/cpp/eljchecklistbox.cpp
  35. +0 −67 wxcore-2.8/src/cpp/eljchoice.cpp
  36. +0 −66 wxcore-2.8/src/cpp/eljclipboard.cpp
  37. +0 −46 wxcore-2.8/src/cpp/eljcoldata.cpp
  38. +0 −119 wxcore-2.8/src/cpp/eljcolour.cpp
  39. +0 −16 wxcore-2.8/src/cpp/eljcolourdlg.cpp
  40. +0 −179 wxcore-2.8/src/cpp/eljcombobox.cpp
  41. +0 −132 wxcore-2.8/src/cpp/eljcommand.cpp
  42. +0 −244 wxcore-2.8/src/cpp/eljconfigbase.cpp
  43. +0 −23 wxcore-2.8/src/cpp/eljcontrol.cpp
  44. +0 −100 wxcore-2.8/src/cpp/eljctxhelp.cpp
  45. +0 −30 wxcore-2.8/src/cpp/eljcursor.cpp
  46. +0 −52 wxcore-2.8/src/cpp/eljdataformat.cpp
  47. +0 −589 wxcore-2.8/src/cpp/eljdatetime.cpp
  48. +0 −730 wxcore-2.8/src/cpp/eljdc.cpp
  49. +0 −51 wxcore-2.8/src/cpp/eljdcsvg.cpp
  50. +0 −43 wxcore-2.8/src/cpp/eljdialog.cpp
  51. +0 −102 wxcore-2.8/src/cpp/eljdialup.cpp
  52. +0 −51 wxcore-2.8/src/cpp/eljdirdlg.cpp
  53. +0 −403 wxcore-2.8/src/cpp/eljdnd.cpp
  54. +0 −16 wxcore-2.8/src/cpp/eljdrawing.cpp
  55. +0 −1,861 wxcore-2.8/src/cpp/eljevent.cpp
  56. +0 −133 wxcore-2.8/src/cpp/eljfiledialog.cpp
  57. +0 −94 wxcore-2.8/src/cpp/eljfilehist.cpp
  58. +0 −118 wxcore-2.8/src/cpp/eljfindrepldlg.cpp
  59. +0 −258 wxcore-2.8/src/cpp/eljfont.cpp
  60. +0 −91 wxcore-2.8/src/cpp/eljfontdata.cpp
  61. +0 −24 wxcore-2.8/src/cpp/eljfontdlg.cpp
  62. +0 −212 wxcore-2.8/src/cpp/eljframe.cpp
  63. +0 −51 wxcore-2.8/src/cpp/eljgauge.cpp
  64. +0 −418 wxcore-2.8/src/cpp/eljgizmos.cpp
  65. +0 −1,372 wxcore-2.8/src/cpp/eljgrid.cpp
  66. +0 −135 wxcore-2.8/src/cpp/eljhelpcontroller.cpp
  67. +0 −49 wxcore-2.8/src/cpp/eljicnbndl.cpp
  68. +0 −128 wxcore-2.8/src/cpp/eljicon.cpp
  69. +0 −247 wxcore-2.8/src/cpp/eljimage.cpp
  70. +0 −74 wxcore-2.8/src/cpp/eljimagelist.cpp
  71. +0 −126 wxcore-2.8/src/cpp/eljipc.cpp
  72. +0 −454 wxcore-2.8/src/cpp/eljjoystick.cpp
  73. +0 −181 wxcore-2.8/src/cpp/eljlayoutconstraints.cpp
  74. +0 −114 wxcore-2.8/src/cpp/eljlistbox.cpp
  75. +0 −487 wxcore-2.8/src/cpp/eljlistctrl.cpp
  76. +0 −80 wxcore-2.8/src/cpp/eljlocale.cpp
  77. +0 −211 wxcore-2.8/src/cpp/eljlog.cpp
  78. +0 −16 wxcore-2.8/src/cpp/eljmask.cpp
  79. +0 −77 wxcore-2.8/src/cpp/eljmdi.cpp
  80. +0 −346 wxcore-2.8/src/cpp/eljmenu.cpp
  81. +0 −133 wxcore-2.8/src/cpp/eljmenubar.cpp
  82. +0 −21 wxcore-2.8/src/cpp/eljmessagedialog.cpp
  83. +0 −148 wxcore-2.8/src/cpp/eljmime.cpp
  84. +0 −11 wxcore-2.8/src/cpp/eljminiframe.cpp
  85. +0 −158 wxcore-2.8/src/cpp/eljnotebook.cpp
  86. +0 −68 wxcore-2.8/src/cpp/eljpalette.cpp
  87. +0 −40 wxcore-2.8/src/cpp/eljpanel.cpp
  88. +0 −165 wxcore-2.8/src/cpp/eljpen.cpp
Sorry, we could not display the entire diff because it was too big.
View
4 wx-2.8/Setup.lhs
@@ -1,4 +0,0 @@
-#!/usr/bin/env runhaskell
-
-> import Distribution.Simple
-> main = defaultMain
View
573 wx-2.8/license.txt
@@ -1,573 +0,0 @@
-----------------------------------------------------------------------
- PREAMBLE
-
-The wxHaskell libraries are distributed under the wxWindows library
-license. The documentation is subject to the wxWidgets documentation
-license.
-
-See "http://www.wxwidgets.org/newlicen.htm" for the legal description
-of the license, which is also included in this document.
-
-The wxWindows library licence is essentially the L-GPL (Library General
-Public Licence), with an exception stating that derived works in binary
-form may be distributed on the user's own terms. This means that it is
-possible to create commercial software with this library without paying
-royalties or disclosing source code. This is a solution that satisfies
-those who wish to produce GPL'ed software using wxHaskell, and also
-those producing proprietary software.
-
-This library is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the wxWidgets
-library license for more details.
-
-
-----------------------------------------------------------------------
- WXWINDOWS LIBRARY LICENCE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Library General Public Licence as published by
- the Free Software Foundation; either version 2 of the Licence, or (at
- your option) any later version.
-
- This library is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
- General Public Licence for more details.
-
- You should have received a copy of the GNU Library General Public Licence
- along with this software, usually in a file named COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- Boston, MA 02111-1307 USA.
-
- EXCEPTION NOTICE
-
- 1. As a special exception, the copyright holders of this library give
- permission for additional uses of the text contained in this release of
- the library as licenced under the wxWindows Library Licence, applying
- either version 3 of the Licence, or (at your option) any later version of
- the Licence as published by the copyright holders of version 3 of the
- Licence document.
-
- 2. The exception is that you may use, copy, link, modify and distribute
- under the user's own terms, binary object code versions of works based
- on the Library.
-
- 3. If you copy code from files distributed under the terms of the GNU
- General Public Licence or the GNU Library General Public Licence into a
- copy of this library, as this licence permits, the exception does not
- apply to the code that you add in this way. To avoid misleading anyone as
- to the status of such modified files, you must delete this exception
- notice from such code and/or adjust the licensing conditions notice
- accordingly.
-
- 4. If you write modifications of your own for this library, it is your
- choice whether to permit this exception to apply to your modifications.
- If you do not wish that, you must delete the exception notice from such
- code and/or adjust the licensing conditions notice accordingly.
-
-
-----------------------------------------------------------------------
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
View
60 wx-2.8/src/Graphics/UI/WX.hs
@@ -1,60 +0,0 @@
---------------------------------------------------------------------------------
-{-| Module : WX
- Copyright : (c) Daan Leijen 2003
- License : wxWindows
-
- Maintainer : wxhaskell-devel@lists.sourceforge.net
- Stability : provisional
- Portability : portable
-
-The WX module just re-exports functionality from helper modules and
-defines the 'start' function.
-
-The WX library provides a /haskellized/ interface to the raw wxWindows
-functionality provided by the "Graphics.UI.WXCore" library.
--}
---------------------------------------------------------------------------------
-module Graphics.UI.WX
- ( -- * Functions
- start
- -- * Modules
- , module Graphics.UI.WX.Types
- , module Graphics.UI.WX.Attributes
- , module Graphics.UI.WX.Classes
- , module Graphics.UI.WX.Variable
- , module Graphics.UI.WX.Layout
- , module Graphics.UI.WX.Events
-
- , module Graphics.UI.WX.Window
- , module Graphics.UI.WX.Frame
- , module Graphics.UI.WX.Timer
- , module Graphics.UI.WX.Media
- , module Graphics.UI.WX.Menu
- , module Graphics.UI.WX.Controls
- , module Graphics.UI.WX.Dialogs
- , module Graphics.UI.WX.Draw
- ) where
-
-import Graphics.UI.WX.Types
-import Graphics.UI.WX.Attributes
-import Graphics.UI.WX.Classes
-import Graphics.UI.WX.Variable
-import Graphics.UI.WX.Layout
-import Graphics.UI.WX.Events
-
-import Graphics.UI.WX.Window
-import Graphics.UI.WX.Frame
-import Graphics.UI.WX.Timer
-import Graphics.UI.WX.Media
-import Graphics.UI.WX.Menu
-
-import Graphics.UI.WX.Controls
-import Graphics.UI.WX.Dialogs
-import Graphics.UI.WX.Draw
-
-import Graphics.UI.WXCore
-
--- | 'start' runs the GUI.
-start :: IO a -> IO ()
-start io
- = run (unitIO io)
View
344 wx-2.8/src/Graphics/UI/WX/Attributes.hs
@@ -1,344 +0,0 @@
-{-# LANGUAGE ExistentialQuantification #-}
---------------------------------------------------------------------------------
-{-| Module : Attributes
- Copyright : (c) Daan Leijen 2003
- License : wxWindows
-
- Maintainer : wxhaskell-devel@lists.sourceforge.net
- Stability : provisional
- Portability : portable
-
-
-Widgets @w@ can have attributes of type @a@ represented by the type 'Attr' @w a@.
-An example of an attribute is 'Graphics.UI.WX.Classes.text' with type:
-
-> text :: Attr (Window a) String
-
-This means that any object derived from 'Window' has a 'Graphics.UI.WX.Classes.text' attribute of type 'String'.
-An attribute can be read with the 'get' function:
-
-> get w title :: IO String
-
-When an attribute is associated with a value, we call it a /property/ of type 'Prop' @w@.
-Properties are constructed by assigning a value to an attribute with the (':=') constructor:
-
-> text := "hello world" :: Prop (Window a)
-
-A list of properties can be set with the 'set' function:
-
-> set w [text := "Hi"] :: IO ()
-
-The (':~') constructor is used to transform an attribute value with an update function.
-For example, the 'interval' on a timer can be doubled with the following expression.
-
-> set timer [interval :~ (*2)]
-
-The functions 'get', 'set', (':='), and (':~') are polymorphic and work for all widgets, but
-the @text@ attribute just works for windows. Many attributes work for different kind
-of objects and are organised into type classes. Actually, the real type of the
-'Graphics.UI.WX.Classes.text' attribute is:
-
-> Textual w => Attr w String
-
-and 'Window' derived objects are part of this class:
-
-> instance Textual (Window a)
-
-But also menus and status fields:
-
-> instance Textual (Menu a)
-> instance Textual (StatusField)
-
-Sometimes, it is convenient to also get a reference to the object itself when setting
-a property. The operators ('::=') and ('::~') provide this reference.
--}
---------------------------------------------------------------------------------
-module Graphics.UI.WX.Attributes
- (
- -- * Attributes
- Attr, Prop((:=),(:~),(::=),(::~)), ReadAttr, WriteAttr, CreateAttr
- , get, set, swap
- , mapAttr, mapAttrW
-
-
- -- * Internal
-
- -- ** Attributes
- , newAttr, readAttr, writeAttr, nullAttr, constAttr, makeAttr
-
- -- ** Reflection
- , attrName, propName, containsProperty
-
- -- ** Reflective attributes
- , reflectiveAttr, createAttr, withProperty, findProperty
- , withStyleProperty, withStylePropertyNot
-
- -- *** Filter
- , PropValue(..)
- , filterProperty
-
- -- ** Cast
- , castAttr, castProp, castProps
- ) where
-
-import Graphics.UI.WX.Types
-import Data.Dynamic
-
-infixr 0 :=,:~,::=,::~
-
--- | A property of a widget @w@ is an attribute that
--- is already associated with a value. .
-data Prop w = forall a. Attr w a := a -- ^ Assign a value to an attribute.
- | forall a. Attr w a :~ (a -> a) -- ^ Apply an update function to an attribute.
- | forall a. Attr w a ::= (w -> a) -- ^ Assign a value to an attribute with the widget as argument.
- | forall a. Attr w a ::~ (w -> a -> a) -- ^ Apply an update function to an attribute with the widget as an argument.
-
-
--- | An attribute that should be specified at creation time. Just for documentation purposes.
-type CreateAttr w a = Attr w a
-
--- | A read-only attribute. Just for documentation purposes.
-type ReadAttr w a = Attr w a
-
--- | A write-only attribute. Just for documentation purposes.
-type WriteAttr w a = Attr w a
-
--- | Widgets @w@ can have attributes of type @a@.
-data Attr w a = Attr String (Maybe (a -> Dynamic, Dynamic -> Maybe a)) -- name, dynamic conversion
- (w -> IO a) (w -> a -> IO ()) -- getter setter
- (w -> (a -> a) -> IO a) -- updater
-
-
--- | Cast attributes.
-castAttr :: (v -> w) -> Attr w a -> Attr v a
-castAttr coerce (Attr name mbdyn getter setter upd)
- = Attr name mbdyn (\v -> getter (coerce v)) (\v x -> (setter (coerce v) x))
- (\v f -> upd (coerce v) f)
-
--- | Cast properties
-castProp :: (v -> w) -> Prop w -> Prop v
-castProp coerce prop
- = case prop of
- (attr := x) -> (castAttr coerce attr) := x
- (attr :~ f) -> (castAttr coerce attr) :~ f
- (attr ::= f) -> (castAttr coerce attr) ::= (\v -> f (coerce v))
- (attr ::~ f) -> (castAttr coerce attr) ::~ (\v x -> f (coerce v) x)
-
--- | Cast a list of properties.
-castProps :: (v -> w) -> [Prop w] -> [Prop v]
-castProps coerce props
- = map (castProp coerce) props
-
--- | Create a /reflective/ attribute with a specified name: value can possibly
--- retrieved using 'getPropValue'. Note: the use of this function is discouraged
--- as it leads to non-compositional code.
-reflectiveAttr :: Typeable a => String -> (w -> IO a) -> (w -> a -> IO ()) -> Attr w a
-reflectiveAttr name getter setter
- = Attr name (Just (toDyn, fromDynamic)) getter setter updater
- where
- updater w f = do x <- getter w; setter w (f x); return x
-
--- | Create a /reflective/ attribute with a specified name: value can possibly
--- retrieved using 'getPropValue'. Note: the use of this function is discouraged
--- as it leads to non-compositional code.
-createAttr :: Typeable a => String -> (w -> IO a) -> (w -> a -> IO ()) -> CreateAttr w a
-createAttr name getter setter
- = reflectiveAttr name getter setter
-
--- | Create a new attribute with a specified name, getter, setter, and updater function.
-makeAttr :: String -> (w -> IO a) -> (w -> a -> IO ()) -> (w -> (a -> a) -> IO a) -> Attr w a
-makeAttr name getter setter updater
- = Attr name Nothing getter setter updater
-
-
--- | Create a new attribute with a specified name, getter and setter function.
-newAttr :: String -> (w -> IO a) -> (w -> a -> IO ()) -> Attr w a
-newAttr name getter setter
- = makeAttr name getter setter updater
- where
- updater w f = do x <- getter w; setter w (f x); return x
-
-
--- | Define a read-only attribute.
-readAttr :: String -> (w -> IO a) -> ReadAttr w a
-readAttr name getter
- = newAttr name getter (\w x -> ioError (userError ("attribute '" ++ name ++ "' is read-only.")))
-
--- | Define a write-only attribute.
-writeAttr :: String -> (w -> a -> IO ()) -> WriteAttr w a
-writeAttr name setter
- = newAttr name (\w -> ioError (userError ("attribute '" ++ name ++ "' is write-only."))) setter
-
--- | A dummy attribute.
-nullAttr :: String -> WriteAttr w a
-nullAttr name
- = writeAttr name (\w x -> return ())
-
--- | A constant attribute.
-constAttr :: Typeable a => String -> a -> Attr w a
-constAttr name x
- = newAttr name (\w -> return x) (\w x -> return ())
-
-
--- | (@mapAttr get set attr@) maps an attribute of @Attr w a@ to
--- @Attr w b@ where (@get :: a -> b@) is used when the attribute is
--- requested and (@set :: a -> b -> a@) is applied to current
--- value when the attribute is set.
-mapAttr :: (a -> b) -> (a -> b -> a) -> Attr w a -> Attr w b
-mapAttr get set (Attr name reflect getter setter updater)
- = Attr name Nothing
- (\w -> do a <- getter w; return (get a))
- (\w b -> do a <- getter w; setter w (set a b))
- (\w f -> do a <- updater w (\a -> set a (f (get a))); return (get a))
-
--- | (@mapAttrW conv attr@) maps an attribute of @Attr w a@ to
--- @Attr v a@ where (@conv :: v -> w@) is used to convert a widget
--- @v@ into a widget of type @w@.
-mapAttrW :: (v -> w) -> Attr w a -> Attr v a
-mapAttrW f attr
- = castAttr f attr
-
--- | Get the value of an attribute
---
--- > t <- get w text
---
-get :: w -> Attr w a -> IO a
-get w (Attr name reflect getter setter updater)
- = getter w
-
--- | Set a list of properties.
---
--- > set w [text := "Hi"]
---
-set :: w -> [Prop w] -> IO ()
-set w props
- = mapM_ setprop props
- where
- setprop ((Attr name reflect getter setter updater) := x)
- = setter w x
- setprop ((Attr name reflect getter setter updater) :~ f)
- = do updater w f; return ()
- setprop ((Attr name reflect getter setter updater) ::= f)
- = setter w (f w)
- setprop ((Attr name reflect getter setter updater) ::~ f)
- = do updater w (f w); return ()
-
--- | Set the value of an attribute and return the old value.
-swap :: w -> Attr w a -> a -> IO a
-swap w (Attr name reflect getter setter updater) x
- = updater w (const x)
-
--- | Retrieve the name of an attribute
-attrName :: Attr w a -> String
-attrName (Attr name _ _ _ _)
- = name
-
--- | Retrieve the name of a property.
-propName :: Prop w -> String
-propName (attr := x) = attrName attr
-propName (attr :~ f) = attrName attr
-propName (attr ::= f) = attrName attr
-propName (attr ::~ f) = attrName attr
-
-
--- | Is a certain property in a list of properties?
-containsProperty :: Attr w a -> [Prop w] -> Bool
-containsProperty attr props
- = containsPropName (attrName attr) props
-
--- | Is a certain property in a list of properties?
-containsPropName :: String -> [Prop w] -> Bool
-containsPropName name props
- = any (\p -> propName p == name) props
-
-
--- | Property value: used when retrieving a property from a list.
-data PropValue a = PropValue a
- | PropModify (a -> a)
- | PropNone
-
-instance Show a => Show (PropValue a) where
- show (PropValue x) = "PropValue " ++ show x
- show (PropModify f) = "PropModify"
- show (PropNone) = "PropNone"
-
--- | Retrieve the value of a property and the list with the property removed.
-filterProperty :: Typeable a => Attr w a -> [Prop w] -> (PropValue a, [Prop w])
-filterProperty (Attr name _ _ _ _) props
- = walk [] PropNone props
- where
- -- Daan: oh, how a simple thing like properties can result into this... ;-)
- walk :: Typeable a => [Prop w] -> PropValue a -> [Prop w] -> (PropValue a, [Prop w])
- walk acc res props
- = case props of
- -- Property setter found.
- (((Attr attr (Just (todyn,fromdyn)) _ _ _) := x):rest) | name == attr
- -> case fromDynamic (todyn x) of
- Just x -> walk acc (PropValue x) rest
- Nothing -> walk acc res props
-
- -- Property modifier found.
- (((Attr attr (Just (todyn,fromdyn)) _ _ _) :~ f):rest) | name == attr
- -> let dynf x = case fromdyn (toDyn x) of
- Just xx -> case fromDynamic (todyn (f xx)) of
- Just y -> y
- Nothing -> x -- identity
- Nothing -> x -- identity
- in case res of
- PropValue x -> walk acc (PropValue (dynf x)) rest
- PropModify g -> walk acc (PropModify (dynf . g)) rest
- PropNone -> walk acc (PropModify dynf) rest
-
- -- Property found, but with the wrong arguments
- (((Attr attr _ _ _ _) := _):rest) | name == attr -> stop
- (((Attr attr _ _ _ _) :~ _):rest) | name == attr -> stop
- (((Attr attr _ _ _ _) ::= _):rest) | name == attr -> stop
- (((Attr attr _ _ _ _) ::~ _):rest) | name == attr -> stop
-
- -- Defaults
- (prop:rest)
- -> walk (prop:acc) res rest
- [] -> stop
- where
- stop = (res, reverse acc ++ props)
-
-
--- | Try to find a property value and call the contination function with that value
--- and the property list witht the searched property removed. If the property is not
--- found, use the default value and the unchanged property list.
-withProperty :: Typeable a => Attr w a -> a -> (a -> [Prop w] -> b) -> [Prop w] -> b
-withProperty attr def cont props
- = case filterProperty attr props of
- (PropValue x, ps) -> cont x ps
- (PropModify f, ps) -> cont (f def) ps
- (PropNone, ps) -> cont def ps
-
--- | Try to find a property value. Return |Nothing| if not found at all.
-findProperty :: Typeable a => Attr w a -> a -> [Prop w] -> Maybe (a,[Prop w])
-findProperty attr def props
- = case filterProperty attr props of
- (PropValue x, ps) -> Just (x,ps)
- (PropModify f, ps) -> Just (f def,ps)
- (PropNone, ps) -> Nothing
-
-
-
--- | Transform the properties based on a style property.
-withStyleProperty :: Attr w Bool -> Style -> ([Prop w] -> Style -> a) -> [Prop w] -> Style -> a
-withStyleProperty prop flag
- = withStylePropertyEx prop (bitsSet flag) (\isSet style -> if isSet then (style .+. flag) else (style .-. flag))
-
--- | Transform the properties based on a style property. The flag is interpreted negatively, i.e. |True|
--- removes the bit instead of setting it.
-withStylePropertyNot :: Attr w Bool -> Style -> ([Prop w] -> Style -> a) -> [Prop w] -> Style -> a
-withStylePropertyNot prop flag
- = withStylePropertyEx prop (not . bitsSet flag) (\isSet style -> if isSet then (style .-. flag) else (style .+. flag))
-
-
--- | Transform the properties based on a style property.
-withStylePropertyEx :: Attr w Bool -> (Style -> Bool) -> (Bool -> Style -> Style) -> ([Prop w] -> Style -> a) -> [Prop w] -> Style -> a
-withStylePropertyEx prop def transform cont props style
- = case filterProperty prop props of
- (PropValue x, ps) -> cont ps (transform x style)
- (PropModify f, ps) -> cont ps (transform (f (def style)) style)
- (PropNone, ps) -> cont ps style
View
388 wx-2.8/src/Graphics/UI/WX/Classes.hs
@@ -1,388 +0,0 @@
-{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, DeriveDataTypeable, ScopedTypeVariables #-}
---------------------------------------------------------------------------------
-{-| Module : Classes
- Copyright : (c) Daan Leijen 2003
- License : wxWindows
-
- Maintainer : wxhaskell-devel@lists.sourceforge.net
- Stability : provisional
- Portability : portable
-
-This modules defines attributes common to many widgets and
-organizes them into Haskell classes. Look at the instance definitions
-to see what kind of widgets support the attributes.
-
-Sometimes it is
-hard to find what attributes a certain widget supports since the instance
-definitions might be on some class higher in the hierarchy. For example,
-many instances are defined for 'Window' @a@ -- this means that all
-those attributes are applicable to any kind of 'Window', i.e. frames,
-buttons, panels etc. However, these attributes will not be explicitly
-listed at the type definitions of those classes.
--}
---------------------------------------------------------------------------------
-module Graphics.UI.WX.Classes
- (
- -- * Data types
- Border(..)
-
- -- * Text
- , Textual(text,appendText)
- , Literate(font ,fontFamily, fontFace, fontSize, fontWeight, fontUnderline, fontShape
- ,textColor,textBgcolor)
- -- * Rendering
- , Dimensions(..)
- , Colored(..)
- , Visible(..)
- , Bordered(..)
- -- * Hierarchy
- , Child(..)
- , Parent(..)
- , Closeable(..)
- -- * Containers
- , Selection( selection )
- , Selections( selections )
- , Items( itemCount, item, items, itemAppend, itemDelete, itemsDelete )
- -- * Misc.
- , Able( enabled ) -- , enable
- , Help( help )
- , Tipped( tooltip )
- , Identity( identity )
- , Styled( style )
- , Framed( resizeable, maximizeable, minimizeable, closeable )
- , Checkable( checkable, checked )
- , Dockable( dockable )
- , Pictured( picture )
- , Valued( value )
- , Sized( size )
- , HasDefault( unsafeDefaultItem, defaultButton )
- ) where
-
-import Data.Dynamic
-import Graphics.UI.WXCore
-
-import Graphics.UI.WX.Types
-import Graphics.UI.WX.Attributes
-import Graphics.UI.WX.Layout
-
-
--- | Widgets with a label or text field.
-class Textual w where
- -- | The text of a widget. It is interpreted differently for
- -- for different widgets, for example, the title of a frame or the content of a
- -- static text control.
- text :: Attr w String
- appendText :: w -> String -> IO ()
-
- appendText w s
- = set w [text :~ (++s)]
-
-
--- | Widgets with a picture.
-class Pictured w where
- -- | The image of a widget.
- picture :: Attr w FilePath
-
-
--- | Widgets with a font.
-class Literate w where
- -- | The font of the widget.
- font :: Attr w FontStyle
-
- -- | The font size.
- fontSize :: Attr w Int
-
- -- | The font weight.
- fontWeight :: Attr w FontWeight
-
- -- | The font family.
- fontFamily :: Attr w FontFamily
-
- -- | The font style.
- fontShape :: Attr w FontShape
-
- -- | The font /face/: determines a platform dependent font.
- fontFace :: Attr w String
-
- -- | Is the font underlined?
- fontUnderline :: Attr w Bool
-
- -- | Text color.
- textColor :: Attr w Color
-
- -- | Text background color
- textBgcolor:: Attr w Color
-
- fontSize = mapAttr _fontSize (\finfo x -> finfo{ _fontSize = x }) font
- fontWeight = mapAttr _fontWeight (\finfo x -> finfo{ _fontWeight = x }) font
- fontFamily = mapAttr _fontFamily (\finfo x -> finfo{ _fontFamily = x }) font
- fontShape = mapAttr _fontShape (\finfo x -> finfo{ _fontShape = x }) font
- fontFace = mapAttr _fontFace (\finfo x -> finfo{ _fontFace = x }) font
- fontUnderline = mapAttr _fontUnderline (\finfo x -> finfo{ _fontUnderline = x }) font
-
-
-
--- | Widgets that have a size.
-class Dimensions w where
- -- | The outer size of a widget (in pixels).
- outerSize :: Attr w Size
- -- | The (relative) position of a widget.
- position :: Attr w Point
- -- | The occupied area.
- area :: Attr w Rect
- -- | The preferred size of a widget.
- bestSize :: ReadAttr w Size
- -- | The area available for client use (i.e. without the border etc).
- clientSize :: Attr w Size
- -- | The virtual size of a widget (ie. the total scrolling area)
- virtualSize :: Attr w Size
-
- -- defaults
- outerSize
- = mapAttr rectSize (\r sz -> rect (rectTopLeft r) sz) area
- position
- = mapAttr rectTopLeft (\r pt -> rect pt (rectSize r)) area
- area
- = newAttr "area" getArea setArea
- where
- getArea w
- = do sz <- get w outerSize
- pt <- get w position
- return (rect pt sz)
- setArea w rect
- = set w [outerSize := rectSize rect, position := rectTopLeft rect]
-
- clientSize
- = outerSize
- bestSize
- = outerSize
- virtualSize
- = clientSize
-
-class Colored w where
- -- | The background color.
- bgcolor :: Attr w Color
- -- | The (foreground) color
- color :: Attr w Color
-
- bgcolor
- = nullAttr "bgcolor"
- color
- = nullAttr "color"
-
--- | Visible widgets.
-class Visible w where
- -- | Is the widget visible?
- visible :: Attr w Bool
- -- | Refresh the widget explicitly.
- refresh :: w -> IO ()
-
- -- | Should the widget be fully repainted on resize? This attribute only
- -- has effect when set at creation. If 'False', you will have to repaint
- -- the new window area manually at a resize, but flickering caused by
- -- background redraws can be prevented in this way. ('False' by default)
- fullRepaintOnResize :: Attr w Bool
- fullRepaintOnResize
- = nullAttr "fullRepaintOnResize"
-
- -- defaults
- visible
- = nullAttr "visible"
- refresh w
- = return ()
-
--- | Parent widgets.
-class Parent w where
- -- | Get the child widgets of a window.
- children :: ReadAttr w [Window ()]
- children = nullAttr "window"
-
- -- | Reduce flicker by not redrawing the background under child controls.
- -- This attribute has to be set at creation time. ('True' by default)
- clipChildren :: Attr w Bool
- clipChildren
- = nullAttr "clipChildren"
-
-
--- | Window borders
-data Border = BorderSimple -- ^ Displays a thin border around the window.
- | BorderDouble -- ^ Displays a double border. Windows only.
- | BorderSunken -- ^ Displays a sunken border.
- | BorderRaised -- ^ Displays a raised border.
- | BorderStatic -- ^ Displays a border suitable for a static control. Windows only
- | BorderNone -- ^ No border
- deriving (Eq,Show,Read,Typeable)
-
-instance BitMask Border where
- assocBitMask
- = [(BorderSimple, wxBORDER)
- ,(BorderDouble, wxDOUBLE_BORDER)
- ,(BorderSunken, wxSUNKEN_BORDER)
- ,(BorderRaised, wxRAISED_BORDER)
- ,(BorderStatic, wxSTATIC_BORDER)
- ,(BorderNone, 0)]
-
-
--- | Widgets with a border.
-class Bordered w where
- -- | Specify the border of a widget.
- border :: Attr w Border
- border = nullAttr "border"
-
-
--- | Widgets that are part of a hierarchical order.
-class Child w where
- -- | The parent widget.
- parent :: ReadAttr w (Window ())
-
- -- defaults
- parent
- = readAttr "parent" (\w -> return objectNull)
-
-
--- | Widgets that can be closed.
-class Closeable w where
- -- | Close the widget.
- close :: w -> IO ()
-
--- | Widgets that have a system frame around them.
-class Framed w where
- -- | Make the widget user resizeable? This attribute must be set at creation time.
- resizeable :: Attr w Bool
- resizeable = nullAttr "resizeable"
-
- -- | Can the widget be minimized? This attribute must be set at creation time.
- minimizeable :: Attr w Bool
- minimizeable = nullAttr "minimizeable"
-
- -- | Can the widget be maximized? This attribute must be set at creation time
- -- and is normally used together with 'resizeable'.
- maximizeable :: Attr w Bool
- maximizeable = nullAttr "maximizeable"
-
- -- | Can the widget be closed by the user? This attribute must be set at creation time.
- closeable :: Attr w Bool
- closeable = nullAttr "closeable"
-
-
--- | Widgets that can be enabled or disabled.
-class Able w where
- -- | Enable, or disable, the widget.
- enabled :: Attr w Bool
-
-{-# DEPRECATED enable "Use enabled instead" #-}
--- | Deprecated: use 'enabled' instead
-enable :: Able w => Attr w Bool
-enable = enabled
-
--- | Widgets with help text.
-class Help w where
- -- | Short help text, normally displayed in the status bar or popup balloon.
- help :: Attr w String
-
--- | Checkable widgets
-class Checkable w where
- -- | Is the widget checkable?
- checkable :: Attr w Bool
- -- | Is the widget checked?
- checked :: Attr w Bool
-
--- | The identity determines the wxWindows ID of a widget.
-class Identity w where
- -- | The identity determines the wxWindows ID of a widget.
- identity :: Attr w Int
-
-
--- | The style is a bitmask that determines various properties of a widget.
-class Styled w where
- -- | The windows style.
- style :: Attr w Int
-
--- | Dockable widgets.
-class Dockable w where
- -- | Is the widget dockable?
- dockable :: Attr w Bool
-
--- | Widgets that have a tooltip
-class Tipped w where
- -- | The tooltip information
- tooltip :: Attr w String
-
--- | Widgets with a single selection (radio group or listbox)
-class Selection w where
- -- | The current selection as a zero-based index.
- -- Certain widgets return -1 when no item is selected.
- selection :: Attr w Int
-
--- | Widget with zero or more selections (multi select list boxes)
-class Selections w where
- -- | The currently selected items in zero-based indices.
- selections :: Attr w [Int]
-
-
--- | Widgets containing certain items (like strings in a listbox)
-class Items w a | w -> a where
- -- | Number of items.
- itemCount :: ReadAttr w Int
- -- | All the items as a list. This attribute might not be writable for some widgets (like radioboxes)
- items :: Attr w [a]
- -- | An item by zero-based index.
- item :: Int -> Attr w a
- -- | Delete an item. Only valid for writeable items.
- itemDelete :: w -> Int -> IO ()
- -- | Delete all items. Only valid for writeable items.
- itemsDelete :: w -> IO ()
- -- | Append an item. Only valid for writeable items.
- itemAppend :: w -> a -> IO ()
-
- items
- = newAttr "items" getter setter
- where
- getter :: w -> IO [a]
- getter w
- = do n <- get w itemCount
- mapM (\i -> get w (item i)) [0..n-1]
-
- setter :: w -> [a] -> IO ()
- setter w xs
- = do itemsDelete w
- mapM_ (\x -> itemAppend w x) xs
-
- itemAppend w x
- = do xs <- get w items
- set w [items := xs ++ [x]]
-
- itemsDelete w
- = do count <- get w itemCount
- sequence_ (replicate count (itemDelete w 0))
-
-{--------------------------------------------------------------------------
- Values
---------------------------------------------------------------------------}
--- | Items with a value.
-class Valued w where
- -- | The value of an object.
- value :: Attr (w a) a
-
-{--------------------------------------------------------------------------
- Size
---------------------------------------------------------------------------}
--- | Sized objects (like bitmaps)
-class Sized w where
- -- | The size of an object. (is 'outerSize' for 'Dimensions' widgets).
- size :: Attr w Size
-
-{--------------------------------------------------------------------------
- HasDefault
---------------------------------------------------------------------------}
--- | Objects which activate a 'Window' by default keypress
-class HasDefault w where
- -- | Define a default item as any type deriving from 'Window'. Great care
- -- is required when using this option as you will have to cast the item
- -- to/from Window() using 'objectCast'.
- -- For the common use case where the window in question is a 'Button',
- -- please use 'defaultButton' as it is typesafe.
- unsafeDefaultItem :: Attr w (Window ())
- -- | Define the default button for a 'TopLevelWindow'. This is recommended
- -- for most use cases as the most common default control is a 'Button'.
- defaultButton :: Attr w (Button ())
View
1,286 wx-2.8/src/Graphics/UI/WX/Controls.hs
@@ -1,1286 +0,0 @@
-
-{-# LANGUAGE TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, DeriveDataTypeable #-}
---------------------------------------------------------------------------------
-{-| Module : Controls
- Copyright : (c) Daan Leijen 2003
- (c) Shelarcy (shelarcy@gmail.com) 2006
- License : wxWindows
-
- Maintainer : wxhaskell-devel@lists.sourceforge.net
- Stability : provisional
- Portability : portable
-
-Defines common GUI controls.
--}
---------------------------------------------------------------------------------
-module Graphics.UI.WX.Controls
- ( -- * Classes
- Align(..), Aligned, alignment
- , Wrap(..), Wrapped, wrap
- , Sorted, sorted
- -- * Containers
- , Panel, panel, panelEx
- , Notebook, notebook
- , focusOn
- -- * Controls
- -- ** Button
- , Button, button, buttonEx, smallButton, buttonRes
- , BitmapButton, bitmapButton, bitmapButtonRes
- -- ** Text entry
- , TextCtrl, entry, textEntry, textCtrl, textCtrlRich, textCtrlEx
- , textCtrlRes, processEnter, processTab
- -- ** CheckBox
- , CheckBox, checkBox, checkBoxRes
- -- ** Choice
- , Choice, choice, choiceEx, choiceRes
- -- ** ComboBox
- , ComboBox, comboBox, comboBoxEx, comboBoxRes
- -- ** ListBox
- , ListBox, SingleListBox, MultiListBox
- , singleListBox, singleListBoxRes, multiListBox, multiListBoxRes
- -- ** RadioBox
- , RadioBox, radioBox, radioBoxRes
- -- ** Spin Control
- , SpinCtrl, spinCtrl, spinCtrlRes
- -- ** Slider
- , Slider, hslider, vslider, sliderEx, sliderRes
- -- ** Gauge
- , Gauge, hgauge, vgauge, gaugeEx, gaugeRes
- -- ** Tree control
- , TreeCtrl, treeCtrl, treeCtrlEx, treeEvent, treeCtrlRes
- -- ** List control
- , ListCtrl, listCtrl, listCtrlEx, listCtrlRes, listCtrlSetColumnWidths, listEvent, columns
- , ListView(..), listViewLayout, listViewSetHandler, listViewSelectHandle, listViewSetItems, listViewGetItems, listViewAddItem, listView
- -- ** Static text
- , StaticText, staticText, staticTextRes
- -- ** SplitterWindow
- , SplitterWindow, splitterWindow
- -- ** ImageList
- , ImageList, imageList, imageListFromFiles
- -- ** MediaCtrl
- , MediaCtrlBackend(..), MediaCtrl, mediaCtrl, mediaCtrlWithBackend, mediaCtrlEx
- -- ** StyledTextCtrl
- , StyledTextCtrl, stcEvent, styledTextCtrl, styledTextCtrlEx
- ) where
-
-import Graphics.UI.WXCore hiding (Event)
-
-import Graphics.UI.WX.Types
-import Graphics.UI.WX.Attributes
-import Graphics.UI.WX.Classes
-import Graphics.UI.WX.Events
-import Graphics.UI.WX.Layout
-import Graphics.UI.WX.Media (Media(..))
-import Graphics.UI.WX.Variable (variable)
-import Graphics.UI.WX.Window
-
-import Control.Monad (forM_)
-import Data.Dynamic -- for "alignment"
-
-
-defaultStyle
- = wxCLIP_CHILDREN -- .+. wxNO_FULL_REPAINT_ON_RESIZE
-
--- | Create a 'Panel', a window that is normally used as a container for
--- controls. It has a standard background and maintains standard keyboard
--- navigation (ie. /Tab/ moves through the controls).
---
--- Note: 'defaultButton' attibute is removed. Set 'defaultButton' to parent
--- 'Frame' or 'Dialog' instead of this control now. This is an incompatible
--- change to support wxWidgets 2.8.x.
---
--- * Attributes: 'focusOn'
---
--- * Instances: 'Form' -- 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled',
--- 'Textual', 'Literate'
-panel :: Window a -> [Prop (Panel ())] -> IO (Panel ())
-panel parent props
- = panelEx parent (wxTAB_TRAVERSAL .+. defaultStyle) props
-
-
--- | Create a 'Panel' with a specific style.
---
--- Note: 'defaultButton' attibute is removed. Set 'defaultButton' to parent
--- 'Frame' or 'Dialog' instead of this control now. This is an incompatible
--- change to support wxWidgets 2.8.x.
---
--- * Attributes: 'focusOn'
---
--- * Instances: 'Form' -- 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled',
--- 'Textual', 'Literate', 'Reactive', 'Paint'
-panelEx :: Window a -> Style -> [Prop (Panel ())] -> IO (Panel ())
-panelEx parent style props
- = feed2 props style $
- initialContainer $ \id rect -> \props flags ->
- do p <- panelCreate parent id rect flags
- windowSetFocus p
- set p props
- return p
-
-instance Form (Panel a) where
- layout
- = writeAttr "layout" windowSetLayout
-
--- | Set the initial focus on this control.
-focusOn :: Window a -> IO ()
-focusOn w
- = windowSetFocus w
-
-
--- | Create a 'Notebook'. Layout is managed with the 'tabs' combinator.
---
--- * Instances: 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled',
--- 'Textual', 'Literate', 'Reactive', 'Paint'
-notebook :: Window a -> [Prop (Notebook ())] -> IO (Notebook ())
-notebook parent props
- = feed2 props defaultStyle $
- initialContainer $ \id rect -> \props flags ->
- do nb <- notebookCreate parent id rect flags
- set nb props
- return nb
-
-{--------------------------------------------------------------------------------
- Button
---------------------------------------------------------------------------------}
-
--- | Create a standard push button.
---
--- * Instances: 'Commanding' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
-button :: Window a -> [Prop (Button ())] -> IO (Button ())
-button parent props
- = buttonEx parent 0 props
-
--- | Create a minimially sized push button.
---
---
--- * Instances: 'Commanding' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
-smallButton :: Window a -> [Prop (Button ())] -> IO (Button ())
-smallButton parent props
- = buttonEx parent wxBU_EXACTFIT props
-
-
--- | Create a standard push button with the given flags.
---
--- * Instances: 'Commanding' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
-buttonEx :: Window a -> Style -> [Prop (Button ())] -> IO (Button ())
-buttonEx parent stl props
- = feed2 props stl $
- initialWindow $ \id rect ->
- initialText $ \txt -> \props flags ->
- do b <- buttonCreate parent id txt rect flags
- set b props
- return b
-
--- | Complete the construction of a push button instance which has been loaded
--- from a resource file.
---
--- * Instances: 'Commanding' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
-buttonRes :: Window a -> String -> [Prop (Button ())] -> IO (Button ())
-buttonRes parent name props =
- do b <- xmlResourceGetButton parent name
- set b props
- return b
-
-instance Commanding (Button a) where
- command = newEvent "command" buttonGetOnCommand buttonOnCommand
-
--- | Create a bitmap button. Use the 'image' attribute to set the
--- bitmap.
---
--- * Instances: 'Commanding' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
-bitmapButton :: Window a -> [Prop (BitmapButton ())] -> IO (BitmapButton ())
-bitmapButton parent props
- = feed2 props wxBU_AUTODRAW $
- initialWindow $ \id rect -> \props flags ->
- do bb <- bitmapButtonCreate parent id nullBitmap rect flags
- set bb props
- return bb
-
--- | Complete the construction of a bitmap button instance which has been loaded
--- from a resource file.
---
--- * Instances: 'Commanding' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
-bitmapButtonRes :: Window a -> String -> [Prop (BitmapButton ())] -> IO (BitmapButton ())
-bitmapButtonRes parent name props =
- do b <- xmlResourceGetBitmapButton parent name
- set b props
- return b
-
-instance Pictured (BitmapButton a) where
- picture
- = writeAttr "picture" setter
- where
- setter w fname
- = do fpath <- getAbsoluteFilePath fname
- withBitmapFromFile fpath (bitmapButtonSetBitmapLabel w)
-
-
-{--------------------------------------------------------------------------------
- Text entry
---------------------------------------------------------------------------------}
--- | Alignment.
-data Align = AlignLeft | AlignRight | AlignCentre
- deriving (Eq,Show,Read,Typeable)
-
--- | Wrap mode.
-data Wrap = WrapNone -- ^ No wrapping (and show a horizontal scrollbar).
- | WrapLine -- ^ Wrap lines that are too long at any position.
- | WrapWord -- ^ Wrap lines that are too long at word boundaries.
- deriving (Eq,Show,Read,Typeable)
-
-instance BitMask Align where
- assocBitMask
- = [(AlignCentre,wxALIGN_CENTRE_HORIZONTAL)
- ,(AlignRight, wxALIGN_RIGHT)
- ,(AlignLeft, wxALIGN_LEFT)]
-
-instance BitMask Wrap where
- assocBitMask
- = [(WrapNone, wxHSCROLL)
- ,(WrapLine, wxTE_LINEWRAP)
- ,(WrapWord, wxTE_WORDWRAP)]
-
-
--- | Widgets that can have aligned content.
--- Note: this property is not
--- used to set the alignment of a widget itself -- See "Graphics.UI.WXCore.Layout"
--- for more information about layout.
-class Aligned w where
- -- | Set the alignment of the content. Due to wxWidgets constrictions,
- -- this property has to be set at creation time.
- alignment :: CreateAttr w Align
-
-initialAlignment :: Aligned w => ([Prop w] -> Style -> a) -> [Prop w] -> Style -> a
-initialAlignment cont props style
- = case filterProperty alignment props of
- (PropValue x, ps) -> cont ps (setBitMask x style)
- (PropModify f, ps) -> cont ps (setBitMask (f (fromBitMask style)) style)
- (PropNone, ps) -> cont ps style
-
-
-instance Aligned (TextCtrl a) where
- alignment
- = reflectiveAttr "alignment" getter setter
- where
- getter w
- = do st <- get w style
- return (fromBitMask st)
-
- setter w align
- = set w [style :~ setBitMask align ]
-
--- | Widgets that have wrappable content.
-class Wrapped w where
- -- | Set the wrap mode of a widget.
- wrap :: CreateAttr w Wrap
-
-initialWrap cont props style
- = case filterProperty wrap props of
- (PropValue x, ps) -> cont ps (setBitMask x style)
- (PropModify f, ps) -> cont ps (setBitMask (f (fromBitMask style)) style)
- (PropNone, ps) -> cont ps style
-
-instance Wrapped (TextCtrl a) where
- wrap
- = reflectiveAttr "wrap" getter setter
- where
- getter w
- = do st <- get w style
- return (fromBitMask st)
-
- setter w mode
- = set w [style :~ setBitMask mode]
-
-
-
-{-
-instance Able (TextCtrl a) where
- enabled
- = newAttr "enabled" textCtrlIsEditable textCtrlSetEditable
--}
-
--- | Create a single-line text entry control. Note: 'alignment' has to
--- be set at creation time (or the entry has default alignment (=left) ).
---
--- * Instances: 'Wrap', 'Aligned', 'Commanding' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
-entry :: Window a -> [Prop (TextCtrl ())] -> IO (TextCtrl ())
-entry parent props
- = textCtrlEx parent wxTE_RICH props
-
--- | Create a single-line text entry control. Note: 'alignment' has to
--- be set at creation time (or the entry has default alignment (=left) ).
---
--- * Instances: 'Wrap', 'Aligned', 'Commanding' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
-textEntry :: Window a -> [Prop (TextCtrl ())] -> IO (TextCtrl ())
-textEntry parent props
- = textCtrlEx parent wxTE_RICH props
-
--- | Create a multi-line text control. Note: the 'wrap' and 'alignment'
--- have to be set at creation time or the default to 'WrapNone' and 'AlignLeft' respectively.
---
--- * Instances: 'Wrap', 'Aligned', 'Commanding' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
-textCtrl :: Window a -> [Prop (TextCtrl ())] -> IO (TextCtrl ())
-textCtrl parent props
- = textCtrlEx parent (wxTE_MULTILINE .+. wxTE_RICH) props
-
-
--- | Create a multi-line text rich-text control with a certain wrap mode
--- Enables font and color settings on windows, while being equal to 'textCtrl'
--- on other platforms. Note: the 'wrap' and 'alignment'
--- have to be set at creation time or the default to 'WrapNone' and 'AlignLeft' respectively.
---
--- * Instances: 'Wrap', 'Aligned', 'Commanding' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
-textCtrlRich :: Window a -> [Prop (TextCtrl ())] -> IO (TextCtrl ())
-textCtrlRich parent props
- = textCtrlEx parent (wxTE_MULTILINE .+. wxTE_RICH2) props
-
--- | Create a generic text control given a certain style.
---
--- * Instances: 'Wrap', 'Aligned', 'Commanding' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
-textCtrlEx :: Window a -> Style -> [Prop (TextCtrl ())] -> IO (TextCtrl ())
-textCtrlEx parent stl props
- = feed2 props stl $
- initialWindow $ \id rect ->
- initialWrap $
- initialAlignment $ \props flags ->
- do e <- textCtrlCreate parent id "" rect flags
- set e props
- return e
-
--- | Complete the construction of a text control instance which has been loaded
--- from a resource file.
---
--- * Instances: 'Wrap', 'Aligned', 'Commanding' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
-textCtrlRes :: Window a -> String -> [Prop (TextCtrl ())] -> IO (TextCtrl ())
-textCtrlRes parent name props =
- do t <- xmlResourceGetTextCtrl parent name
- set t props
- return t
-
-instance Commanding (TextCtrl a) where
- command = newEvent "command" textCtrlGetOnTextEnter textCtrlOnTextEnter
-
--- | Process @enter@ key events, used in a 'comboBox' or 'textCtrl' and
--- catched using a 'on' 'command' handler.
--- (otherwise pressing @Enter@ is either processed
--- internally by the control or used for navigation between dialog controls).
-processEnter :: Styled w => Attr w Bool
-processEnter
- = newAttr "processEnter" getter setter
- where
- getter w
- = do s <- get w style
- return (bitsSet wxTE_PROCESS_ENTER s)
- setter w p
- = set w [style :~ \stl -> stl .+. wxTE_PROCESS_ENTER]
-
-
--- | Process @tab@ key events, used in a 'comboBox' or 'textCtrl'.
--- (otherwise pressing @Tab@ is either processed
--- internally by the control or used for navigation between dialog controls).
-processTab :: Styled w => Attr w Bool
-processTab
- = newAttr "processTab" getter setter
- where
- getter w
- = do s <- get w style
- return (bitsSet wxTE_PROCESS_TAB s)
- setter w p
- = set w [style :~ \stl -> stl .+. wxTE_PROCESS_TAB]
-
-
-{--------------------------------------------------------------------------------
- Static text
---------------------------------------------------------------------------------}
--- | Create static text label, see also 'label'.
-staticText :: Window a -> [Prop (StaticText ())] -> IO (StaticText ())
-staticText parent props
- = feed2 props 0 $
- initialWindow $ \id rect ->
- initialText $ \txt -> \props flags ->
- do t <- staticTextCreate parent id txt rect flags {- (wxALIGN_LEFT + wxST_NO_AUTORESIZE) -}
- set t props
- return t
-
--- | Complete the construction of a static text label instance which has been loaded
--- from a resource file.
-staticTextRes :: Window a -> String -> [Prop (StaticText ())] -> IO (StaticText ())
-staticTextRes parent name props =
- do t <- xmlResourceGetStaticText parent name
- set t props
- return t
-
-{--------------------------------------------------------------------------------
- Check box
---------------------------------------------------------------------------------}
-instance Commanding (CheckBox a) where
- command = newEvent "command" checkBoxGetOnCommand checkBoxOnCommand
-
-instance Checkable (CheckBox a) where
- checkable
- = enabled
-
- checked
- = newAttr "checked" checkBoxGetValue checkBoxSetValue
-
--- | Create a new checkbox.
---
--- * Instances: 'Commanding','Checkable' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
-checkBox :: Window a -> [Prop (CheckBox ())] -> IO (CheckBox ())
-checkBox parent props
- = feed2 props 0 $
- initialWindow $ \id rect ->
- initialText $ \txt -> \props flags ->
- do c <- checkBoxCreate parent id txt rect flags
- set c props
- return c
-
--- | Complete the construction of a check box instance which has been loaded
--- from a resource file.
---
--- * Instances: 'Commanding','Checkable' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
-checkBoxRes :: Window a -> String -> [Prop (CheckBox ())] -> IO (CheckBox ())
-checkBoxRes parent name props =
- do c <- xmlResourceGetCheckBox parent name
- set c props
- return c
-
-{--------------------------------------------------------------------------------
- Choice
---------------------------------------------------------------------------------}
--- | Widgets that have sorted contents.
-class Sorted w where
- -- | Is the content of the widget sorted?
- sorted :: CreateAttr w Bool
-
-instance Sorted (Choice a) where
- sorted
- = createAttr "sorted" getter setter
- where
- getter w
- = do st <- get w style
- return (bitsSet wxCB_SORT st)
- setter w sort
- = set w [style :~ \st -> if sort then st .+. wxCB_SORT else st .-. wxCB_SORT]
-
-initialSorted :: Sorted w => ([Prop w] -> Style -> a) -> [Prop w] -> Style -> a
-initialSorted
- = withStyleProperty sorted wxCB_SORT
-
-
-instance Selecting (Choice ()) where
- select = newEvent "select" choiceGetOnCommand choiceOnCommand
-
-instance Selection (Choice ()) where
- selection
- = newAttr "selection" choiceGetSelection choiceSetSelection
-
-
-instance Items (Choice a) String where
- itemCount
- = readAttr "itemCount" choiceGetCount
-
- item i
- = newAttr "item" (\w -> choiceGetString w i) (\w x -> choiceSetString w i x)
-
- itemAppend w x
- = choiceAppend w x
-
- itemDelete w i
- = choiceDelete w i
-
-
--- | Create a choice item to select a one of a list of strings.
---
--- * Instances: 'Sorted', 'Selecting','Selection','Items' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
-choice :: Window a -> [Prop (Choice ())] -> IO (Choice ())
-choice parent props
- = choiceEx parent 0 props
-
-
--- | Create a choice item, given a set of style flags, to select a one of a list of strings
---
--- * Instances: 'Selecting','Selection','Items' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
-choiceEx :: Window a -> Style -> [Prop (Choice ())] -> IO (Choice ())
-choiceEx parent flags props
- = feed2 props flags $
- initialWindow $ \id rect ->
- initialSorted $ \props flags ->
- do c <- choiceCreate parent id rect [] flags
- set c props
- return c
-
--- | Complete the construction of a choice instance which has been loaded
--- from a resource file.
-choiceRes :: Window a -> String -> [Prop (Choice ())] -> IO (Choice ())
-choiceRes parent name props =
- do c <- xmlResourceGetChoice parent name
- set c props
- return c
-
-{--------------------------------------------------------------------------------
- ComboBox
---------------------------------------------------------------------------------}
-instance Commanding (ComboBox a) where
- command
- = newEvent "command" comboBoxGetOnTextEnter comboBoxOnTextEnter
-
-instance Selecting (ComboBox a) where
- select
- = newEvent "select" comboBoxGetOnCommand comboBoxOnCommand
-
-instance Selection (ComboBox a) where
- selection
- = newAttr "selection" comboBoxGetSelection comboBoxSetSelection
-
-
--- implemented by choice
-{-
-instance Items (ComboBox a) String where
- itemCount
- = readAttr "itemCount" comboBoxGetCount
-
- item i
- = readAttr "item" (\w -> comboBoxGetString w i) -- (\w x -> comboBoxSetString w i x)
-
- itemAppend w x
- = comboBoxAppend w x
-
- itemDelete w i
- = comboBoxDelete w i
--}
-
--- | Create a new combo box.
---
--- * Instances: 'Selecting', 'Commanding','Selection','Items' -- 'Textual', 'Literate', 'Dimensions',
--- 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
--- A 'command' event is triggered when the @enter@ key is pressed and when
--- 'processEnter' has been set to 'True'.
-comboBox :: Window a -> [Prop (ComboBox ())] -> IO (ComboBox ())
-comboBox parent props
- = comboBoxEx parent (wxCB_DROPDOWN) props
-
-
--- | Create a new combo box with a given set of flags.
---
--- * Instances: 'Selecting', 'Commanding','Selection','Items' -- 'Textual', 'Literate', 'Dimensions',
--- 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
--- A 'command' event is triggered when the @enter@ key is pressed and when
--- 'processEnter' has been set to 'True'.
-comboBoxEx :: Window a -> Style -> [Prop (ComboBox ())] -> IO (ComboBox ())
-comboBoxEx parent flags props
- = feed2 props flags $
- initialWindow $ \id rect ->
- initialText $ \txt ->
- initialSorted $ \props flags ->
- do cb <- comboBoxCreate parent id txt rect [] flags
- set cb props
- return cb
-
--- | Complete the construction of a combo box instance which has been loaded
--- from a resource file.
-comboBoxRes :: Window a -> String -> [Prop (ComboBox ())] -> IO (ComboBox ())
-comboBoxRes parent name props =
- do c <- xmlResourceGetComboBox parent name
- set c props
- return c
-
-{--------------------------------------------------------------------------------
- ListBox
---------------------------------------------------------------------------------}
-instance Sorted (ListBox a) where
- sorted
- = createAttr "sorted" getter setter
- where
- getter w
- = do st <- get w style
- return (bitsSet wxLB_SORT st)
- setter w sort
- = set w [style :~ \st -> if sort then st .+. wxLB_SORT else st .-. wxLB_SORT]
-
-
-
-instance Selecting (ListBox a) where
- select
- = newEvent "select" listBoxGetOnCommand listBoxOnCommand
-
-instance Items (ListBox a) String where
- itemCount
- = readAttr "itemCount" listBoxGetCount
-
- item i
- = newAttr "item" (\w -> listBoxGetString w i) (\w x -> listBoxSetString w i x)
-
- itemAppend w x
- = listBoxAppend w x
-
- itemDelete w i
- = listBoxDelete w i
-
--- | Pointer to single selection list boxes, deriving from 'ListBox'.
-type SingleListBox a = ListBox (CSingleListBox a)
-
--- | Abstract type of the 'SingleListBox' class.
-data CSingleListBox a = CSingleListBox
-
-instance Selection (SingleListBox a) where
- selection
- = newAttr "selection" listBoxGetSelection (\w x -> listBoxSetSelection w x True)
-
-
--- | Pointer to multiple selection list boxes, deriving from 'ListBox'.
-type MultiListBox a = ListBox (CMultiListBox a)
-
--- | Abstract type of the 'MultiListBox' class.
-data CMultiListBox a = CMultiListBox
-
-instance Selections (MultiListBox a) where
- selections
- = newAttr "selections" listBoxGetSelectionList setter
- where
- setter w is =
- do oldSelection <- listBoxGetSelectionList w
- sequence_ [ listBoxSetSelection w i False -- deselect old selections
- | i <- oldSelection
- , i `notElem` is -- but not the ones in the new selection
- ]
- mapM_ (\i -> listBoxSetSelection w i True) is
-
-
--- | Create a single selection list box.
---
--- * Instances: 'Sorted','Selecting','Selection','Items' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
-singleListBox :: Window a -> [Prop (SingleListBox ())] -> IO (SingleListBox ())
-singleListBox parent props
- = feed2 props (wxLB_SINGLE .+. wxHSCROLL .+. wxLB_NEEDED_SB) $
- initialWindow $ \id rect ->
- initialSorted $ \props flags ->
- do lb <- listBoxCreate parent id rect [] flags
- let sl = (objectCast lb :: SingleListBox ())
- set sl props
- return sl
-
--- | Complete the construction of a single list box instance which has been loaded
--- from a resource file.
-singleListBoxRes :: Window a -> String -> [Prop (SingleListBox ())] -> IO (SingleListBox ())
-singleListBoxRes parent name props =
- do l <- xmlResourceGetListBox parent name
- let sl = (objectCast l :: SingleListBox())
- set sl props
- return sl
-
--- | Create a multi selection list box.
-----
--- * Instances: 'Sorted', 'Selecting','Selections','Items' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
-multiListBox :: Window a -> [Prop (MultiListBox ())] -> IO (MultiListBox ())
-multiListBox parent props
- = feed2 props (wxLB_MULTIPLE .+. wxLB_EXTENDED .+. wxHSCROLL .+. wxLB_NEEDED_SB) $
- initialWindow $ \id rect ->
- initialSorted $ \props flags ->
- do lb <- listBoxCreate parent id rect [] flags
- let ml = (objectCast lb :: MultiListBox ())
- set ml props
- return ml
-
--- | Complete the construction of a single list box instance which has been loaded
--- from a resource file.
-multiListBoxRes :: Window a -> String -> [Prop (MultiListBox ())] -> IO (MultiListBox ())
-multiListBoxRes parent name props =
- do l <- xmlResourceGetListBox parent name
- let ml = (objectCast l :: MultiListBox())
- set ml props
- return ml
-
-{--------------------------------------------------------------------------------
- RadioBox
---------------------------------------------------------------------------------}
-instance Selecting (RadioBox a) where
- select
- = newEvent "select" radioBoxGetOnCommand radioBoxOnCommand
-
-instance Selection (RadioBox a) where
- selection
- = newAttr "selection" radioBoxGetSelection radioBoxSetSelection
-
-instance Items (RadioBox a) String where
- itemCount
- = readAttr "itemCount" radioBoxNumber
-
- item i
- = newAttr "item" (\r -> radioBoxGetItemLabel r i) (\r s -> radioBoxSetItemLabel r i s)
-
- itemAppend
- = error "Controls.itemAppend: you can not append items to a radiobox"
-
- itemDelete
- = error "Controls.itemDelete: you can not delete items of a radiobox"
-
-
--- | Create a new radio button group with an initial orientation and a list of
--- labels. Use 'selection' to get the currently selected item.
---
--- * Instances: 'Selecting','Selection','Items' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
-radioBox :: Window a -> Orientation -> [String] -> [Prop (RadioBox ())] -> IO (RadioBox ())
-radioBox parent direction labels props
- = feed2 props (if (direction==Horizontal) then wxRA_SPECIFY_ROWS else wxRA_SPECIFY_COLS) $
- initialWindow $ \id rect ->
- initialText $ \title -> \props flags ->
- do r <- radioBoxCreate parent id title rect labels 1 flags
- set r props
- return r
-
--- | Complete the construction of a radio box instance which has been loaded
--- from a resource file.
-radioBoxRes :: Window a -> String -> [Prop (RadioBox ())] -> IO (RadioBox ())
-radioBoxRes parent name props =
- do rb <- xmlResourceGetRadioBox parent name
- set rb props
- return rb
-
-{--------------------------------------------------------------------------------
- Gauge
---------------------------------------------------------------------------------}
--- | Create a horizontal gauge with a specified integer range (max value).
--- The 'selection' attribute determines the position of the gauge.
---
--- * Instances: 'Selection' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
-hgauge :: Window a -> Int -> [Prop (Gauge ())] -> IO (Gauge ())
-hgauge parent range props
- = gaugeEx parent range (wxHORIZONTAL .+. wxGA_SMOOTH) props
-
--- | Create a vertical gauge with a specified integer range (max value).
--- The 'selection' attribute determines the position of the gauge.
---
--- * Instances: 'Selection' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
-vgauge :: Window a -> Int -> [Prop (Gauge ())] -> IO (Gauge ())
-vgauge parent range props
- = gaugeEx parent range (wxVERTICAL .+. wxGA_SMOOTH) props
-
--- | Create a gauge control.
--- The 'selection' attribute determines the position of the gauge.
---
--- * Instances: 'Selection' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
-gaugeEx :: Window a -> Int -> Style -> [Prop (Gauge ())] -> IO (Gauge ())
-gaugeEx parent range style props
- = do g <- gaugeCreate parent idAny range rectNull style
- set g props
- return g
-
--- | Complete the construction of a gauge instance which has been loaded
--- from a resource file.
-gaugeRes :: Window a -> String -> [Prop (Gauge ())] -> IO (Gauge ())
-gaugeRes parent name props =
- do g <- xmlResourceGetGauge parent name
- set g props
- return g
-
-instance Selection (Gauge a) where
- selection
- = newAttr "selection" getter setter
- where
- getter g
- = do i <- gaugeGetValue g
- hi <- gaugeGetRange g
- return (max 0 (min hi i))
-
- setter g i
- = do hi <- gaugeGetRange g
- gaugeSetValue g (max 0 (min hi i))
-
-{--------------------------------------------------------------------------------
- Slider
---------------------------------------------------------------------------------}
-instance Commanding (Slider a) where
- command = newEvent "command" sliderGetOnCommand sliderOnCommand
-
--- | Create a horizontal slider with a specified minimum and maximum. Set
--- the 'Bool' argument to 'True' to show labels (minimumn, maximum, and
--- current value). The 'selection' attribute gives the current value.
---
--- * Instances: 'Commanding','Selection' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
-hslider :: Window a -> Bool -> Int -> Int -> [Prop (Slider ())] -> IO (Slider ())
-hslider parent showLabels min max props
- = sliderEx parent min max (wxHORIZONTAL .+. (if showLabels then wxSL_LABELS else 0)) props
-
--- | Create a vertical slider with a specified minimum and maximum. Set
--- the 'Bool' argument to 'True' to show labels (minimumn, maximum, and
--- current value). The 'selection' attribute gives the current value.
---
--- * Instances: 'Commanding','Selection' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
-vslider :: Window a -> Bool -> Int -> Int -> [Prop (Slider ())] -> IO (Slider ())
-vslider parent showLabels min max props
- = sliderEx parent min max (wxVERTICAL .+. (if showLabels then wxSL_LABELS else 0)) props
-
--- | Create a slider with a specified minimum and maximum. The
--- 'selection' attribute gives the current value.
---
--- * Instances: 'Commanding','Selection' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
-sliderEx :: Window a -> Int -> Int -> Style -> [Prop (Slider ())] -> IO (Slider ())
-sliderEx parent min max style props
- = do s <- sliderCreate parent style min min max rectNull style
- set s props
- return s
-
--- | Complete the construction of a slider instance which has been loaded
--- from a resource file.
-sliderRes :: Window a -> String -> [Prop (Slider ())] -> IO (Slider ())
-sliderRes parent name props =
- do s <- xmlResourceGetSlider parent name
- set s props
- return s
-
-instance Selection (Slider a) where
- selection
- = newAttr "selection" getter setter
- where
- getter s
- = do i <- sliderGetValue s
- lo <- sliderGetMin s
- hi <- sliderGetMax s
- return (max lo (min hi i))
-
- setter s i
- = do lo <- sliderGetMin s
- hi <- sliderGetMax s
- sliderSetValue s (max lo (min hi i))
-
-
-{--------------------------------------------------------------------------------
- SpinCtrl
---------------------------------------------------------------------------------}
--- | Create a spin control: a text field with up\/down buttons. The value ('selection')
--- is always between a specified minimum and maximum.
---
--- * Instances: 'Selection', 'Selecting' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',
--- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.
---
-spinCtrl :: Window a -> Int -> Int -> [Prop (SpinCtrl ())] -> IO (SpinCtrl ())
-spinCtrl parent lo hi props
- = feed2 props wxSP_ARROW_KEYS $
- initialWindow $ \id rect ->