C# 클래스 Mono.Terminal.Widget

파일 보기 프로젝트 열기: mono/mono-curses 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
Container Container
Fill Fill
h int
w int
x int
y int

공개 메소드들

메소드 설명
BaseMove ( int line, int col ) : void

Move relative to the top of the container

This moves the current cursor position to the specified line and column relative to the start of the container where this widget is located.

The difference between this method and Move is that this method goes to the beginning of the container, while Move goes to the first position that widgets should use.

For example, a Frame usually takes up a couple of characters for padding. This method would position the cursor at the beginning of the frame, while Move would position the cursor within the frame.

Clear ( ) : void

Clears the widget region withthe current color.

This clears the entire region used by this widget.

DoSizeChanged ( ) : void

Method to relayout on size changes.

This method can be overwritten by widgets that might be interested in adjusting their contents or children (if they are containers).

DrawFrame ( int col, int line, int width, int height ) : void

Utility function to draw frames

Draws a frame with the current color in the specified coordinates.

DrawFrame ( int col, int line, int width, int height, bool fill ) : void

Utility function to draw frames

Draws a frame with the current color in the specified coordinates.

DrawHotString ( string s, int hotcolor, int color ) : void

Utility function to draw strings that contain a hotkey

Draws a string with the given color. If a character "_" is found, then the next character is drawn using the hotcolor.

Log ( string s ) : void

Utility function to log messages

This is a utility function that you can use to log messages that will be stored in a file (as curses has taken over the screen and you can not really log information there).

The data is written to the file "log2" for now

Move ( int line, int col ) : void

Moves inside the first location inside the container

This moves the current cursor position to the specified line and column relative to the container client area where this widget is located.

The difference between this method and BaseMove is that this method goes to the beginning of the client area inside the container while BaseMove goes to the first position that container uses.

For example, a Frame usually takes up a couple of characters for padding. This method would position the cursor inside the client area, while BaseMove would position the cursor at the top of the frame.

PositionCursor ( ) : void

Moves inside the first location inside the container

A helper routine that positions the cursor at the logical beginning of the widget. The default implementation merely puts the cursor at the beginning, but derived classes should find a suitable spot for the cursor to be shown.

This method must be overwritten by most widgets since screen repaints can happen at any point and it is important to leave the cursor in a position that would make sense for the user (as not all terminals support hiding the cursor), and give the user an impression of where the cursor is. For a button, that would be the position where the hotkey is, for an entry the location of the editing cursor and so on.

ProcessColdKey ( int key ) : bool

This method can be overwritten by widgets that want to provide accelerator functionality (Alt-key for example), but without interefering with normal ProcessKey behavior.

After keys are sent to the widgets on the current Container, all the widgets are processed and the key is passed to the widgets to allow some of them to process the keystroke as a cold-key.

This functionality is used, for example, by default buttons to act on the enter key. Processing this as a hot-key would prevent non-default buttons from consuming the enter keypress when they have the focus.

ProcessHotKey ( int key ) : bool

This method can be overwritten by widgets that want to provide accelerator functionality (Alt-key for example).

Before keys are sent to the widgets on the current Container, all the widgets are processed and the key is passed to the widgets to allow some of them to process the keystroke as a hot-key.

For example, if you implement a button that has a hotkey ok "o", you would catch the combination Alt-o here. If the event is caught, you must return true to stop the keystroke from being dispatched to other widgets.

Typically to check if the keystroke is an Alt-key combination, you would use Curses.IsAlt(key) and then Char.ToUpper(key) to compare with your hotkey.

ProcessKey ( int key ) : bool

If the widget is focused, gives the widget a chance to process the keystroke.

Widgets can override this method if they are interested in processing the given keystroke. If they consume the keystroke, they must return true to stop the keystroke from being processed by other widgets or consumed by the widget engine. If they return false, the keystroke will be passed out to other widgets for processing.

ProcessMouse ( Curses ev ) : void

Gives widgets a chance to process the given mouse event.

Widgets can inspect the value of ev.ButtonState to determine if this is a message they are interested in (typically ev.ButtonState & Curses.Event.Button1Clicked).

Redraw ( ) : void

Redraws the current widget, must be overwritten.

This method should be overwritten by classes that derive from Widget. The default implementation of this method just fills out the region with the character 'x'.

Widgets are responsible for painting the entire region that they have been allocated.

Widget ( int x, int y, int w, int h ) : System

Public constructor for widgets

Constructs a widget that starts at positio (x,y) and has width w and height h. These parameters are used by the methods Clear and Redraw

메소드 상세

BaseMove() 공개 메소드

Move relative to the top of the container

This moves the current cursor position to the specified line and column relative to the start of the container where this widget is located.

The difference between this method and Move is that this method goes to the beginning of the container, while Move goes to the first position that widgets should use.

For example, a Frame usually takes up a couple of characters for padding. This method would position the cursor at the beginning of the frame, while Move would position the cursor within the frame.

public BaseMove ( int line, int col ) : void
line int
col int
리턴 void

Clear() 공개 메소드

Clears the widget region withthe current color.

This clears the entire region used by this widget.

public Clear ( ) : void
리턴 void

DoSizeChanged() 공개 메소드

Method to relayout on size changes.

This method can be overwritten by widgets that might be interested in adjusting their contents or children (if they are containers).

public DoSizeChanged ( ) : void
리턴 void

DrawFrame() 공개 정적인 메소드

Utility function to draw frames
Draws a frame with the current color in the specified coordinates.
public static DrawFrame ( int col, int line, int width, int height ) : void
col int
line int
width int
height int
리턴 void

DrawFrame() 공개 정적인 메소드

Utility function to draw frames
Draws a frame with the current color in the specified coordinates.
public static DrawFrame ( int col, int line, int width, int height, bool fill ) : void
col int
line int
width int
height int
fill bool
리턴 void

DrawHotString() 공개 정적인 메소드

Utility function to draw strings that contain a hotkey
Draws a string with the given color. If a character "_" is found, then the next character is drawn using the hotcolor.
public static DrawHotString ( string s, int hotcolor, int color ) : void
s string
hotcolor int
color int
리턴 void

Log() 공개 정적인 메소드

Utility function to log messages

This is a utility function that you can use to log messages that will be stored in a file (as curses has taken over the screen and you can not really log information there).

The data is written to the file "log2" for now

public static Log ( string s ) : void
s string
리턴 void

Move() 공개 메소드

Moves inside the first location inside the container

This moves the current cursor position to the specified line and column relative to the container client area where this widget is located.

The difference between this method and BaseMove is that this method goes to the beginning of the client area inside the container while BaseMove goes to the first position that container uses.

For example, a Frame usually takes up a couple of characters for padding. This method would position the cursor inside the client area, while BaseMove would position the cursor at the top of the frame.

public Move ( int line, int col ) : void
line int
col int
리턴 void

PositionCursor() 공개 메소드

Moves inside the first location inside the container

A helper routine that positions the cursor at the logical beginning of the widget. The default implementation merely puts the cursor at the beginning, but derived classes should find a suitable spot for the cursor to be shown.

This method must be overwritten by most widgets since screen repaints can happen at any point and it is important to leave the cursor in a position that would make sense for the user (as not all terminals support hiding the cursor), and give the user an impression of where the cursor is. For a button, that would be the position where the hotkey is, for an entry the location of the editing cursor and so on.

public PositionCursor ( ) : void
리턴 void

ProcessColdKey() 공개 메소드

This method can be overwritten by widgets that want to provide accelerator functionality (Alt-key for example), but without interefering with normal ProcessKey behavior.

After keys are sent to the widgets on the current Container, all the widgets are processed and the key is passed to the widgets to allow some of them to process the keystroke as a cold-key.

This functionality is used, for example, by default buttons to act on the enter key. Processing this as a hot-key would prevent non-default buttons from consuming the enter keypress when they have the focus.

public ProcessColdKey ( int key ) : bool
key int
리턴 bool

ProcessHotKey() 공개 메소드

This method can be overwritten by widgets that want to provide accelerator functionality (Alt-key for example).

Before keys are sent to the widgets on the current Container, all the widgets are processed and the key is passed to the widgets to allow some of them to process the keystroke as a hot-key.

For example, if you implement a button that has a hotkey ok "o", you would catch the combination Alt-o here. If the event is caught, you must return true to stop the keystroke from being dispatched to other widgets.

Typically to check if the keystroke is an Alt-key combination, you would use Curses.IsAlt(key) and then Char.ToUpper(key) to compare with your hotkey.

public ProcessHotKey ( int key ) : bool
key int
리턴 bool

ProcessKey() 공개 메소드

If the widget is focused, gives the widget a chance to process the keystroke.

Widgets can override this method if they are interested in processing the given keystroke. If they consume the keystroke, they must return true to stop the keystroke from being processed by other widgets or consumed by the widget engine. If they return false, the keystroke will be passed out to other widgets for processing.

public ProcessKey ( int key ) : bool
key int
리턴 bool

ProcessMouse() 공개 메소드

Gives widgets a chance to process the given mouse event.
Widgets can inspect the value of ev.ButtonState to determine if this is a message they are interested in (typically ev.ButtonState & Curses.Event.Button1Clicked).
public ProcessMouse ( Curses ev ) : void
ev Curses
리턴 void

Redraw() 공개 메소드

Redraws the current widget, must be overwritten.

This method should be overwritten by classes that derive from Widget. The default implementation of this method just fills out the region with the character 'x'.

Widgets are responsible for painting the entire region that they have been allocated.

public Redraw ( ) : void
리턴 void

Widget() 공개 메소드

Public constructor for widgets

Constructs a widget that starts at positio (x,y) and has width w and height h. These parameters are used by the methods Clear and Redraw

public Widget ( int x, int y, int w, int h ) : System
x int
y int
w int
h int
리턴 System

프로퍼티 상세

Container 공개적으로 프로퍼티

Points to the container of this widget
public Container,Mono.Terminal Container
리턴 Container

Fill 공개적으로 프로퍼티

public Fill Fill
리턴 Fill

h 공개적으로 프로퍼티

The height of this widget, it is the area that receives mouse events and that must be repainted.
public int h
리턴 int

w 공개적으로 프로퍼티

The width of this widget, it is the area that receives mouse events and that must be repainted.
public int w
리턴 int

x 공개적으로 프로퍼티

The x position of this widget
public int x
리턴 int

y 공개적으로 프로퍼티

The y position of this widget
public int y
리턴 int