aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJoel Bodenmann <joel@unormal.org>2013-12-18 16:49:49 +0100
committerJoel Bodenmann <joel@unormal.org>2013-12-18 16:49:49 +0100
commitaa2f7585ce088c505ac955dcb4a9091a4eb22b63 (patch)
treeab95a056d4d135ae7de4e7c1dd21309177eb1dec /include
parent92750f02078b898a5f35957e68ba61a689dc2a85 (diff)
downloaduGFX-aa2f7585ce088c505ac955dcb4a9091a4eb22b63.tar.gz
uGFX-aa2f7585ce088c505ac955dcb4a9091a4eb22b63.tar.bz2
uGFX-aa2f7585ce088c505ac955dcb4a9091a4eb22b63.zip
first implementation of console buffer. This has to be tested first - might contain bugs
Diffstat (limited to 'include')
-rw-r--r--include/gwin/console.h23
-rw-r--r--include/gwin/options.h11
2 files changed, 34 insertions, 0 deletions
diff --git a/include/gwin/console.h b/include/gwin/console.h
index a2dde96b..850c5a57 100644
--- a/include/gwin/console.h
+++ b/include/gwin/console.h
@@ -31,6 +31,13 @@ typedef struct GConsoleObject {
GWindowObject g;
coord_t cx, cy; // Cursor position
+ #if GWIN_CONSOLE_NEED_HISTORY
+ char* buffer; // buffer to store console content
+ uint16_t last_char; // the last rendered character
+ size_t size; // size of buffer
+ bool_t store; // shall PutChar() store into buffer
+ #endif
+
#if GFX_USE_OS_CHIBIOS && GWIN_CONSOLE_USE_BASESTREAM
struct GConsoleWindowStream_t {
const struct GConsoleWindowVMT_t *vmt;
@@ -82,6 +89,22 @@ GHandle gwinGConsoleCreate(GDisplay *g, GConsoleObject *gc, const GWindowInit *p
BaseSequentialStream *gwinConsoleGetStream(GHandle gh);
#endif
+#if GWIN_CONSOLE_NEED_HISTORY
+ /**
+ * @brief Assing a buffer to keep track of the content while the widget is invisible.
+ * @pre GWIN_CONSOLE_NEED_HISTORY must be set to TRUE in your gfxconf.h
+ *
+ * @param[in] gh The window handle (must be a console window)
+ * @param[in] buffer The pointer of the buffer that shall be used. Buffer will be
+ * dynamically allocated when this is NULL.
+ * @param[in] size Size of the buffer that has been passed. If buffer is NULL, this
+ * will be the size of the dynamically allocated buffer.
+ *
+ * @return TRUE on success
+ */
+ bool_t gwinConsoleSetBuffer(GHandle gh, void* buffer, size_t size);
+#endif
+
/**
* @brief Put a character at the cursor position in the window.
* @note Uses the current foreground color to draw the character and fills the background using the background drawing color
diff --git a/include/gwin/options.h b/include/gwin/options.h
index 6e39d54d..c6fe14b8 100644
--- a/include/gwin/options.h
+++ b/include/gwin/options.h
@@ -106,6 +106,17 @@
#define GWIN_BUTTON_LAZY_RELEASE FALSE
#endif
/**
+ * @brief Should the content of the console be logged or not
+ * @details If this feature is enable, the content of the console will be stored.
+ * Every content that gets printed to the console while being invisible
+ * will be rendered once the console is visible again. All previous written
+ * content will be restored too.
+ * @details Defaults to FALSE
+ */
+ #ifndef GWIN_NEED_CONSOLE_HISTORY
+ #define GWIN_NEED_CONSOLE_HISTORY FALSE
+ #endif
+ /**
* @brief Console Windows need floating point support in @p gwinPrintf
* @details Defaults to FALSE
*/