ConsoleFrame Class Reference


Detailed Description
Represents console frames.The console frame contains a Fl_Text_Display object, which is where messages to the console are displayed. The Fl_Text_Display object in turn contains a Fl_Text_Buffer object, which is the data structure storing the actual text. Currently, all ConsoleFrame objects share the same Fl_Text_Buffer, although this may be changed in later revisions.
The console frame also has a tool button for saving the contents of the Fl_Text_Buffer to file. Clicking it saves the buffer to a file with a name in the format robolook_console_yymmdd_hhmmss.txt. If such a file already exists, it will be overwritten.
The ConsoleFrame also inherits the basic frame content selection menu and border drawing functionality from the Frame base class.
Public Member Functions | |
| ConsoleFrame (int x, int y, int w, int h, char *l=0) | |
| Constructs a new ConsoleFrame with the specified location and size. Will call the Frame base class constructor to initialize the frame and get the frame content selection menu. | |
| ConsoleFrame (Frame *frame) | |
| Creates a new console frame. | |
| void | update () |
| Updates the console frame. | |
| virtual void | deregister () |
Deregisters the Frame with its Workspace. | |
| virtual bool | resizable_width (int width) |
Returns true if the frame can be resized to width width. | |
| virtual bool | resizable_height (int height) |
Returns true if the frame can be resized to height height. | |
| virtual Frame * | clone (int x, int y, int w, int h) |
| Creates a clone of the frame with the specified screen dimensions. | |
| virtual void | draw () |
Reimplements the parent draw() method to ensure thread-safe operation by locking the console mutex. | |
Static Public Member Functions | |
| static void | save_callback (Fl_Widget *w, void *data) |
| Callback for the "Save to file" button. Saves the content of the Fl_Text_Buffer to a file. | |
Protected Member Functions | |
| void | init (int x, int y, int w, int h) |
| Constructs a new ConsoleFrame with the specified location and size. This method will initialize a Fl_Text_Display object for displaying console text, and an Fl_Button for saving the file (for which it registers the save_callback() method. | |
| virtual FrameType | frame_type () const |
| Get the type of the frame. | |
| virtual void | resize (int xx, int yy, int ww, int hh) |
Overrides the Fl_Scroll::resize() method to resize the console display window. | |
Private Attributes | |
| Fl_Text_Display * | m_display_buffer |
A pointer to the Fl_Text_Display widget containing the display buffer for this frame. | |
Constructor & Destructor Documentation
| ConsoleFrame | ( | int | x, | |
| int | y, | |||
| int | w, | |||
| int | h, | |||
| char * | l = 0 | |||
| ) |
Constructs a new ConsoleFrame with the specified location and size. Will call the Frame base class constructor to initialize the frame and get the frame content selection menu.
- Parameters:
-
x The x-coordinate of the top left corner of this frame. y The y-coordinate of the top left corner of this frame. w The width of this frame. h The height of this frame. l The widget label (for FLTK compatibility)
| ConsoleFrame | ( | Frame * | frame | ) |
Creates a new console frame.
The new frame will be created to fit the space occupied by frame. The constructor will also take care of registering the frame with the active workspace, and of removing the old frame.
- Parameters:
-
frame The Frameto replace.
Member Function Documentation
| static void save_callback | ( | Fl_Widget * | w, | |
| void * | data | |||
| ) | [static] |
Callback for the "Save to file" button. Saves the content of the Fl_Text_Buffer to a file.
This callback will generate a file name in the format robolook_console_yymmdd_hhmmss.txt, and then call Fl_Text_Buffer::savefile(). If such a file already exists, it will be overwritten.
This callback is registered by the ConsoleFrame constructor, and is called whenever the user clicks the "Save to file" button in a console frame.
- Parameters:
-
w A pointer to the Fl_Text_Display widget in this frame. data A pointer to the Fl_Text_Buffer containing the text to be saved.
| void update | ( | ) |
Updates the console frame.
This method calls Fl_Text_Display::redraw() on its display buffer to update it.
This method is called during a UserInterfaceUtils::send_to_console() call.
| bool resizable_width | ( | int | width | ) | [virtual] |
Returns true if the frame can be resized to width width.
Currently, the minimum width is 50 for console frames.
Implements Frame.
| bool resizable_height | ( | int | height | ) | [virtual] |
Returns true if the frame can be resized to height height.
Currently, the minimum height is 60 for console frames.
Implements Frame.
| void init | ( | int | x, | |
| int | y, | |||
| int | w, | |||
| int | h | |||
| ) | [protected] |
Constructs a new ConsoleFrame with the specified location and size. This method will initialize a Fl_Text_Display object for displaying console text, and an Fl_Button for saving the file (for which it registers the save_callback() method.
The constructor will also automatically fetch a pointer to the common Fl_Text_Buffer object from UserInterfaceUtilities for use with the Fl_Text_Display object.
- Parameters:
-
x The x-coordinate of the top left corner of this frame. y The y-coordinate of the top left corner of this frame. w The width of this frame. h The height of this frame.
| Frame::FrameType frame_type | ( | ) | const [protected, virtual] |
The documentation for this class was generated from the following files:
- src/gui/ConsoleFrame.hh
- src/gui/ConsoleFrame.cc