mirror of https://github.com/texmacs/doc.git
Features and fixes (Qt):
Support for widgets: texmacs-output, texmacs-input, resize, popup (for help balloons), buttons in dialogs, tweaks here and there. Fixes to layouts and sizing, scroll widgets are dummy for most widgets. Support for side tools as another (floatable) QToolBar. Would a QDockWidget be better? Consistent (albeit partial) support for TeXmacs' widget styles. Support for some more widgets as menu items (i.e. as QActions for QToolBar). Fix placement of context menus. New management of ownership of QWidgets. Cleanup and maintenance (Qt): Comments. Many, many comments. Removed unnecessary files. Grouped common method definitions. Shifting around of code for consistency. Documentation regarding widgets and extension of the UI. XCode: update project for XCode4, new xcconfig for MOC objects fixes linker warnings. To do (Qt): Fine-tune the presentation of QWidgets: remove unnecessary spacing, provide default alignment policies, add better support for widgets in QToolBars (see as_qaction()). Finish the popup widget (timeout, etc.) Why are texmacs widgets so often wrapped into vertical widgets? This messes with scrollable_widget. Understand why QPainter is not properly initialized for output widgets, then remove the hack in Texmacs/Window/tm_button.cpp.
This commit is contained in:
parent
54911bd4a9
commit
c93081b807
|
@ -5,23 +5,25 @@
|
|||
<\body>
|
||||
<tmdoc-title|Containers, glue, refresh and cia.>
|
||||
|
||||
<section|Attribute widgets>
|
||||
|
||||
Setting attributes of widgets is achieved by enclosing them in the
|
||||
following special widgets:
|
||||
|
||||
<scm|centered>, <scm|resize>, <scm|padded>, ...\
|
||||
|
||||
<section|Container widgets>
|
||||
|
||||
<scm|centered>
|
||||
You can arrange widgets horizontally or vertically, or in two column mode
|
||||
as in forms. When running the QT version the latter will default to the OS
|
||||
standard for arranging labels and their associated input widgets in
|
||||
dialogs.
|
||||
|
||||
<\scm>
|
||||
aligned
|
||||
</scm>
|
||||
|
||||
<scm|hlist>
|
||||
|
||||
<scm|vlist>
|
||||
|
||||
<scm|padded>
|
||||
<scm|aligned>, <scm|hlist>, <scm|vlist>, <scm|hsplit>, ...
|
||||
|
||||
<section|Glue widgets>
|
||||
|
||||
From the definitions...
|
||||
Shifting of widgets... From the definitions:
|
||||
|
||||
<\verbatim>
|
||||
((== x '---) '$---)
|
||||
|
@ -51,4 +53,6 @@
|
|||
<section|Other topics>
|
||||
|
||||
\;
|
||||
|
||||
\;
|
||||
</body>
|
|
@ -3,23 +3,28 @@
|
|||
<style|tmdoc>
|
||||
|
||||
<\body>
|
||||
<tmdoc-title|An introduction to widgets, dialogs and forms>
|
||||
<tmdoc-title|An introduction to widgets, menus, dialogs and forms>
|
||||
|
||||
<section|Widgets><label|sec:widgets>
|
||||
|
||||
In <TeXmacs> you create visual interfaces using <em|widgets>. This word
|
||||
means either the basic building blocks you have at your disposal, like
|
||||
buttons, popup lists, etc. or the collections of those into dialogs, menus
|
||||
or whatever. This rather loose concept might be confusing, especially when
|
||||
we refer to what usually are know as dialogs as widgets, but it makes sense
|
||||
because all sorts of widgets can be aggregated to build more complicated
|
||||
ones as well.<\footnote>
|
||||
In <TeXmacs> you create and extend the visual interface using <em|widgets>.
|
||||
This word means either the basic building blocks you have at your disposal,
|
||||
like buttons, popup lists, etc. or the collections of those into dialogs,
|
||||
menu bars or whatever. This rather loose concept might be confusing,
|
||||
especially when we refer to what usually are know as dialogs as widgets,
|
||||
but it makes sense because all sorts of widgets can be aggregated to build
|
||||
more complicated ones as well.<\footnote>
|
||||
If you miss some particular ``building block'' from your OS, you might
|
||||
see whether it's feasible as an aggregation of simpler ones or try and
|
||||
play with the UI interface code in C++ (but you'll have to add it for
|
||||
every supported platform!).
|
||||
</footnote>
|
||||
|
||||
However, it must be kept in mind that items intended to be inserted in a
|
||||
menu bar won't necessarily display as they do in a separate window:
|
||||
complicated aggregations of widgets might be better placed in a separate
|
||||
window or dialogue.
|
||||
|
||||
A complete reference with all the available widgets is
|
||||
<hlink|here|scheme-gui-reference.en.tm>, some more examples are here and
|
||||
here.
|
||||
|
@ -67,8 +72,8 @@
|
|||
|
||||
The next step is to add some text next to the button, i.e. a label. This is
|
||||
done with the <scm|text> keyword, as in <scm|(text "Hello")>, but in order
|
||||
to have both widgets sit side by side, you'll need a
|
||||
<inactive|<hlink|container widget|scheme-gui-.en.tm>>, such as <scm|hlist>:
|
||||
to have both widgets sit side by side, you'll need a <hlink|container
|
||||
widget|scheme-gui-container.en.tm>, such as <scm|hlist>:
|
||||
|
||||
<\session|scheme|default>
|
||||
<\unfolded-io|Scheme] >
|
||||
|
@ -115,6 +120,13 @@
|
|||
The special symbol <scm|\<gtr\>\<gtr\>\<gtr\>> is just one of the
|
||||
predefined <hlink|glue widgets|scheme-gui-glue.en.tm>.\
|
||||
|
||||
<section|Menus>
|
||||
|
||||
As we said before, menus are special collections of widgets:
|
||||
|
||||
<with|color|red|Problems with toolbars, system menus, context menus... Menu
|
||||
containers: horizontal menu, vertical menu. Separators.>
|
||||
|
||||
<section|User dialogs><label|sec:dialogs>
|
||||
|
||||
Let's see how you create a dialog. To get started here is one little
|
||||
|
@ -188,11 +200,18 @@
|
|||
</input>
|
||||
</session>
|
||||
|
||||
<with|color|red|This should of course work! ALSO: what is resize with two
|
||||
lists as first arguments?>
|
||||
|
||||
<scm|resize> is one of the several available container or <hlink|content
|
||||
management widgets|scheme-gui-container.en.tm>.
|
||||
management widgets|scheme-gui-container.en.tm>. It accepts two sorts of
|
||||
arguments. Either one sets a fixed size for the widget with two strings, as
|
||||
in the example above, or one passes two lists, the first for widths, the
|
||||
second for heights, with the minimum, default and maximum values in that
|
||||
order, like this:\
|
||||
|
||||
<scm|(resize ("100px" "200px" "400px") ("100px" "200px" "400px")
|
||||
(some-widget-here))>
|
||||
|
||||
This sets <scm|some-widget-here> to have a default square size of 200x200
|
||||
pixels.
|
||||
|
||||
If you want to add the usual buttons you use <scm|bottom-buttons> like in
|
||||
the following example. Notice that the widget now accepts one parameter
|
||||
|
@ -322,8 +341,6 @@
|
|||
A complete list of the widgets you can embed in a form is in the table
|
||||
<scm|gui-make-table> inside <hlink|menu-define.scm|$TEXMACS_PATH/progs/kernel/gui/menu-define.scm>.
|
||||
|
||||
\;
|
||||
|
||||
<tmdoc-copyright|2012|the <TeXmacs> team.>
|
||||
|
||||
<tmdoc-license|Permission is granted to copy, distribute and/or modify
|
||||
|
|
|
@ -8,6 +8,193 @@
|
|||
This should be a comprehensive list of all the widgets available to the
|
||||
user.
|
||||
|
||||
An excerpt from <verbatim|progs/kernel/gui/menu-define.scm>, as of SVN
|
||||
revision 5238:
|
||||
|
||||
<\scm>
|
||||
\;
|
||||
|
||||
(define-table gui-make-table
|
||||
|
||||
\ \ (eval ,gui-make-eval)
|
||||
|
||||
\ \ (dynamic ,gui-make-dynamic)
|
||||
|
||||
\ \ (former ,gui-make-former)
|
||||
|
||||
\ \ (link ,gui-make-link)
|
||||
|
||||
\ \ (let ,gui-make-let)
|
||||
|
||||
\ \ (let* ,gui-make-let)
|
||||
|
||||
\ \ (with ,gui-make-with)
|
||||
|
||||
\ \ (receive ,gui-make-with)
|
||||
|
||||
\ \ (for ,gui-make-for)
|
||||
|
||||
\ \ (cond ,gui-make-cond)
|
||||
|
||||
\ \ (refresh ,gui-make-refresh)
|
||||
|
||||
\ \ (group ,gui-make-group)
|
||||
|
||||
\ \ (text ,gui-make-text)
|
||||
|
||||
\ \ (glue ,gui-make-glue)
|
||||
|
||||
\ \ (color ,gui-make-color)
|
||||
|
||||
\ \ (texmacs-output ,gui-make-texmacs-output)
|
||||
|
||||
\ \ (texmacs-input ,gui-make-texmacs-input)
|
||||
|
||||
\ \ (input ,gui-make-input)
|
||||
|
||||
\ \ (enum ,gui-make-enum)
|
||||
|
||||
\ \ (choice ,gui-make-choice)
|
||||
|
||||
\ \ (choices ,gui-make-choices)
|
||||
|
||||
\ \ (toggle ,gui-make-toggle)
|
||||
|
||||
\ \ (icon ,gui-make-icon)
|
||||
|
||||
\ \ (concat ,gui-make-concat)
|
||||
|
||||
\ \ (verbatim ,gui-make-verbatim)
|
||||
|
||||
\ \ (check ,gui-make-check)
|
||||
|
||||
\ \ (balloon ,gui-make-balloon)
|
||||
|
||||
\ \ (-\<gtr\> ,gui-make-submenu)
|
||||
|
||||
\ \ (=\<gtr\> ,gui-make-top-submenu)
|
||||
|
||||
\ \ (horizontal ,gui-make-horizontal)
|
||||
|
||||
\ \ (vertical ,gui-make-vertical)
|
||||
|
||||
\ \ (hlist ,gui-make-hlist)
|
||||
|
||||
\ \ (vlist ,gui-make-vlist)
|
||||
|
||||
\ \ (aligned ,gui-make-aligned)
|
||||
|
||||
\ \ (item ,gui-make-item)
|
||||
|
||||
\ \ (meti ,gui-make-meti)
|
||||
|
||||
\ \ (tabs ,gui-make-tabs)
|
||||
|
||||
\ \ (tab ,gui-make-tab)
|
||||
|
||||
\ \ (inert ,gui-make-inert)
|
||||
|
||||
\ \ (explicit-buttons ,gui-make-explicit-buttons)
|
||||
|
||||
\ \ (bold ,gui-make-bold)
|
||||
|
||||
\ \ (tile ,gui-make-tile)
|
||||
|
||||
\ \ (scrollable ,gui-make-scrollable)
|
||||
|
||||
\ \ (resize ,gui-make-resize)
|
||||
|
||||
\ \ (hsplit ,gui-make-hsplit)
|
||||
|
||||
\ \ (vsplit ,gui-make-vsplit)
|
||||
|
||||
\ \ (minibar ,gui-make-minibar)
|
||||
|
||||
\ \ (extend ,gui-make-extend)
|
||||
|
||||
\ \ (padded ,gui-make-padded)
|
||||
|
||||
\ \ (centered ,gui-make-centered)
|
||||
|
||||
\ \ (bottom-buttons ,gui-make-bottom-buttons)
|
||||
|
||||
\ \ (assuming ,gui-make-assuming)
|
||||
|
||||
\ \ (if ,gui-make-if)
|
||||
|
||||
\ \ (when ,gui-make-when)
|
||||
|
||||
\ \ (mini ,gui-make-mini)
|
||||
|
||||
\ \ (symbol ,gui-make-symbol)
|
||||
|
||||
\ \ (promise ,gui-make-promise)
|
||||
|
||||
\ \ (ink ,gui-make-ink)
|
||||
|
||||
\ \ (form ,gui-make-form)
|
||||
|
||||
\ \ (form-input ,gui-make-form-input)
|
||||
|
||||
\ \ (form-enum ,gui-make-form-enum)
|
||||
|
||||
\ \ (form-choice ,gui-make-form-choice)
|
||||
|
||||
\ \ (form-choices ,gui-make-form-choices))
|
||||
|
||||
\;
|
||||
|
||||
(tm-define (gui-make x)
|
||||
|
||||
\ \ ;;(display* "x= " x "\\n")
|
||||
|
||||
\ \ (cond ((symbol? x)
|
||||
|
||||
\ \ \ \ \ \ \ \ \ (cond ((== x '---) '$---)
|
||||
|
||||
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ((== x '===) (gui-make '(glue #f #f 0 5)))
|
||||
|
||||
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ((== x '======) (gui-make '(glue #f #f 0
|
||||
15)))
|
||||
|
||||
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ((== x '/) '$/)
|
||||
|
||||
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ((== x '//) (gui-make '(glue #f #f 5 0)))
|
||||
|
||||
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ((== x '///) (gui-make '(glue #f #f 15 0)))
|
||||
|
||||
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ((== x '\<gtr\>\<gtr\>) (gui-make '(glue #t
|
||||
#f 5 0)))
|
||||
|
||||
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ((== x '\<gtr\>\<gtr\>\<gtr\>) (gui-make
|
||||
'(glue #t #f 15 0)))
|
||||
|
||||
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ((== x (string-\<gtr\>symbol "\|")) '$/)
|
||||
|
||||
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (else
|
||||
|
||||
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (texmacs-error "gui-make" "invalid menu
|
||||
item ~S" x))))
|
||||
|
||||
\ \ \ \ \ \ \ \ ((string? x) x)
|
||||
|
||||
\ \ \ \ \ \ \ \ ((and (pair? x) (ahash-ref gui-make-table (car x)))
|
||||
|
||||
\ \ \ \ \ \ \ \ \ (apply (car (ahash-ref gui-make-table (car x))) (list
|
||||
x)))
|
||||
|
||||
\ \ \ \ \ \ \ \ ((and (pair? x) (or (string? (car x)) (pair? (car x))))
|
||||
|
||||
\ \ \ \ \ \ \ \ \ \0($\<gtr\> ,(gui-make (car x)) ,@(cdr x)))
|
||||
|
||||
\ \ \ \ \ \ \ \ (else
|
||||
|
||||
\ \ \ \ \ \ \ \ \ \ (texmacs-error "gui-make" "invalid menu item ~S"
|
||||
x))))
|
||||
|
||||
\;
|
||||
</scm>
|
||||
|
||||
\;
|
||||
|
||||
<tmdoc-copyright|2012|the <TeXmacs> team.>
|
||||
|
|
Loading…
Reference in New Issue