Commit Graph

53 Commits

Author SHA1 Message Date
Alexandre Bury
c07e8b6aee Rustfmt 2016-07-10 19:11:21 -07:00
Alexandre Bury
6e0819f723 Simplify Event enum
Now properly unify Alt/Ctrl/Shift handling
2016-07-10 18:27:26 -07:00
Alexandre Bury
99bf28dfd6 Add needs_relayout method to View trait.
Purely optimization-focused trait (it is safe to ignore it entirely).
Allows view groups to take shortcuts if they know their children didn't
change since last time.
2016-07-10 17:41:49 -07:00
Alexandre Bury
4b095a0652 Apply rustfmt 2016-07-09 19:05:51 -07:00
Alexandre Bury
08ab18608b Clear the screen only on window resize and layer removal
Should actually also be done if a layer shrinks.
Luckily, clear can be called anytime, as draw() is the last action
performed in the event loop - so it's safe to clear the screen in any
event callback, or even during layout.
2016-07-09 18:49:37 -07:00
Alexandre Bury
2860467f29 Cache layout in TextView
Calling either get_min_size or layout will cache the results, so the
next call with the same constraints will not re-compute everything.
2016-07-09 18:23:58 -07:00
Alexandre Bury
8220fe529e Better menubar example
Added scrolling support, and left/right navigation
2016-07-02 19:37:38 -07:00
Alexandre Bury
1d54764cdb Working menubar example
Also update callback: use Rc instead of Box
2016-07-02 15:02:42 -07:00
Alexandre Bury
1863e48b07 Add MenuPopup view 2016-07-02 01:01:09 -07:00
Alexandre Bury
985009e51c More ncurses isolation
Also some renaming in the theme module
2016-06-30 23:38:01 -07:00
Alexandre Bury
5751a293e5 Push most ncurses-specific code into separate trait
Prepare backend change.

Still not isolated is the color setup in `theme`.
2016-06-29 17:37:51 -07:00
Alexandre Bury
d02c30ae9f Fix clippy warnings 2016-06-27 22:40:11 -07:00
Alexandre Bury
042e631d9f Add base for menubar
Cursive now has a global menubar, with a `select_menubar()` method.
2016-06-27 21:59:42 -07:00
Alexandre Bury
34f235daf0 Use UTF-8 drawing characters for printer methods
Instead of ncurses chtype.
2016-06-26 15:03:12 -07:00
Alexandre Bury
07c3c99e54 Update for new ncurses version 2016-03-15 15:39:08 -07:00
Alexandre Bury
36fbc1ce5b Add some convenient ID methods 2015-07-28 15:57:52 +02:00
Alexandre Bury
40af72a567 BugFix in LinearLayout
And add a simple linear example.
2015-06-08 12:23:36 -07:00
Alexandre Bury
df5ff808e3 Basic linear layout implementation
Not tested yet
2015-06-07 20:58:10 -07:00
Alexandre Bury
17e44652b8 Fix warning
Unused error reported.
2015-06-05 21:13:34 -07:00
Alexandre Bury
e5cb687990 Refactor themes and colors
And adds a theme example.
TODO: Shadow & Borders support
2015-06-05 18:26:40 -07:00
Alexandre Bury
cb523e88ae Fix doc-tests 2015-06-04 11:40:35 -07:00
Alexandre Bury
1656cdd8f6 Add Align property to TextView
Can change its horizontal and vertical alignment for when the allocated
size is bigger than the requirements.
2015-06-01 19:43:15 -07:00
Alexandre Bury
969650ab1a Add basic ListView
Show a selection among a list of items.
Maybe should be called SelectView?
TODO:
* Scrolling
* Error handling with empty list
* Action on Enter on an item
2015-05-30 21:05:34 -07:00
Alexandre Bury
37e54b3598 Add input support for Esc 2015-05-28 13:49:13 -07:00
Alexandre Bury
35c48e13d8 Fix backspace detection
Backspace is code 127 (so right inside utf-8 territory) but we want to
treat is as special key, like codes < 32.
2015-05-27 22:38:59 -07:00
Alexandre Bury
3d1507c3cf Add UTF-8 input support
Didn't the proper methods in the standard lib, so I implemented a simple
utf-8 char reader.
2015-05-27 22:17:52 -07:00
Alexandre Bury
f9c9e56518 Transform ncurses i32 key into Event enum
Prepares support for unicode char input spanning multiple ncurses
characters.
2015-05-27 18:04:33 -07:00
Alexandre Bury
44899bdcd6 Add/fix some doc 2015-05-26 16:48:27 -07:00
Alexandre Bury
e8fcaabd6c Add EditView
TODO: proper visualization:
* Display cursor when focused (instead of color change)
* Do not use HIGHLIGHT, but something like INVERTED
2015-05-26 15:48:35 -07:00
Alexandre Bury
25e1ca6074 Rename Margins -> Vec4
And move it to the vec module
2015-05-25 14:56:51 -07:00
Alexandre Bury
dca9d7f662 Use usize for Vec2 instead of u32
Much less casts needed now.
2015-05-25 14:46:29 -07:00
Alexandre Bury
5d9e8f760b Have child views take focus when added to StackView. 2015-05-24 01:22:27 -07:00
Alexandre Bury
081b7545b9 Remove viewpath in callbacks 2015-05-23 17:07:22 -07:00
Alexandre Bury
7e823435cd Stop using ncurses::WINDOW
Overlap is a mess. Let's do it ourselve.
2015-05-23 15:58:06 -07:00
Alexandre Bury
d9b56574d2 Add selector by ID 2015-05-23 10:33:29 -07:00
Alexandre Bury
77aae36836 Fix bad crate doc 2015-05-22 17:25:20 -07:00
Alexandre Bury
7e4873f5b7 Fix logs demo 2015-05-22 17:24:02 -07:00
Alexandre Bury
9fc946d6bd Remove unused mpsc import. 2015-05-22 17:10:47 -07:00
Alexandre Bury
d9652ac728 Add animated example. 2015-05-22 16:28:05 -07:00
Alexandre Bury
25726140d8 Add colors and styles to printer 2015-05-21 23:29:49 -07:00
Alexandre Bury
c8136c67e0 Add focus system
May need to add a direction to take_focus
2015-05-19 15:54:11 -07:00
Alexandre Bury
ca5c485847 Fix Button on_key_event
KEY_ENTER is actually almost never called. The return key sends the
ascii code for '\n' instead.
2015-05-19 10:58:42 -07:00
Alexandre Bury
1fcca9b3a9 Rename module vec2 -> vec
Margins may be moved to vec::Vec4 some day
2015-05-18 11:51:30 -07:00
Alexandre Bury
74f0fee9b6 Add Dialog skeleton 2015-05-16 14:02:15 -07:00
Alexandre Bury
e17ca97136 Add ViewPath and Cursive::find
Callbacks now include a path to the triggering view.
The Cursive root can find the View corresponding to a ViewPath.
In the future, ViewPaths may be returned when creating the layout.
2015-05-15 17:56:38 -07:00
Alexandre Bury
6cd2a28966 StackView now centers its children 2015-05-15 16:06:48 -07:00
Alexandre Bury
90ea4af1ea Implement TextView::draw 2015-05-15 15:00:20 -07:00
Alexandre Bury
6fad4aa36a More documentation 2015-05-15 12:16:58 -07:00
Alexandre Bury
e5c623bb07 Add printer abstraction on ncurses::WINDOW
Also rename Size -> Vec2
2015-05-15 12:03:19 -07:00
Alexandre Bury
4ebb422611 Hide the cursor 2015-05-14 18:41:13 -07:00