NekoWM
A gfxprim proxy backend tiling window manager
Loading...
Searching...
No Matches
Data Structures | Typedefs | Enumerations | Functions
neko_view.h File Reference

View is an abstraction for a piece of a screen. More...

#include <core/gp_core.h>
#include <backends/gp_types.h>

Go to the source code of this file.

Data Structures

struct  neko_view_slot_ops
 A view slot ops. More...
 
struct  neko_view_slot
 A view slot content. More...
 
struct  neko_view
 View a part of a screen. More...
 

Typedefs

typedef struct neko_view_slot_ops neko_view_slot_ops
 A view slot ops.
 
typedef struct neko_view_slot neko_view_slot
 A view slot content.
 
typedef struct neko_view neko_view
 View a part of a screen.
 

Enumerations

enum  neko_view_split_mode
 A split mode. More...
 

Functions

void neko_view_init (neko_view *self, gp_size x, gp_size y, gp_size w, gp_size h, const char *name)
 Initialize a view.
 
neko_viewneko_view_focused_child (neko_view *self)
 Returns view focused child.
 
int neko_view_is_focused (neko_view *self)
 Returns true if view is focused.
 
void neko_view_slot_rem (neko_view *self)
 Removes a slot from a view.
 
static void neko_view_slot_exit (neko_view *self)
 Child did exit.
 
void neko_view_update_rect (neko_view *self, gp_coord x, gp_coord y, gp_size w, gp_size h)
 Update rectangle in the view on the screen.
 
void neko_view_flip (neko_view *self)
 Update whole view on the screen.
 
void neko_view_slot_put (neko_view *self, neko_view_slot *slot)
 Fills in a slot in a neko view.
 
void neko_view_event (neko_view *self, gp_event *ev)
 Sends an input event to a view child.
 
gp_pixmap * neko_view_pixmap (neko_view *self)
 Returns a pixmap for the view.
 
void neko_view_resize (neko_view *self, gp_size w, gp_size h)
 Resizes the view recursively along with all slots.
 
void neko_view_repaint (neko_view *self)
 Request a view repaint.
 
void neko_view_show (neko_view *self)
 Switches a view shown on a display.
 
void neko_view_hide (neko_view *self)
 Hides a view from a display.
 
static void neko_view_focus_in (neko_view *self)
 Sends a focus in event to the view event handler.
 
static void neko_view_focus_out (neko_view *self)
 Sends a focus out event to the view event handler.
 

Detailed Description

View is an abstraction for a piece of a screen.

View can be divided into subviews recursively.

Each view has a slot, if slot is not empty the screen is taken over by the slot content.

Definition in file neko_view.h.

Typedef Documentation

◆ neko_view_slot

A view slot content.

Something to be shown in the view on the screen.

◆ neko_view_slot_ops

A view slot ops.

Callback to render a slot content.

Enumeration Type Documentation

◆ neko_view_split_mode

A split mode.

If view is split it can be split either horizontally or vertically.

Definition at line 31 of file neko_view.h.

Function Documentation

◆ neko_view_event()

void neko_view_event ( neko_view self,
gp_event *  ev 
)

Sends an input event to a view child.

Parameters
selfA neko view.
evAn input event.

Referenced by neko_view_focus_in(), and neko_view_focus_out().

◆ neko_view_flip()

void neko_view_flip ( neko_view self)

Update whole view on the screen.

This is called by the child when content needs to be updated from the view pixmap and painted on the screen.

Parameters
selfA neko view.

◆ neko_view_focus_in()

static void neko_view_focus_in ( neko_view self)
inlinestatic

Sends a focus in event to the view event handler.

Parameters
selfA view.

Definition at line 304 of file neko_view.h.

References neko_view_event().

◆ neko_view_focus_out()

static void neko_view_focus_out ( neko_view self)
inlinestatic

Sends a focus out event to the view event handler.

Parameters
selfA view.

Definition at line 320 of file neko_view.h.

References neko_view_event().

◆ neko_view_focused_child()

neko_view * neko_view_focused_child ( neko_view self)

Returns view focused child.

Parameters
selfA neko view.
Returns
Focused child, or NULL if view does not have any children.

◆ neko_view_hide()

void neko_view_hide ( neko_view self)

Hides a view from a display.

This function can be called only on a view that is currently shown on a screen.

Parameters
selfA currently shown view.

◆ neko_view_init()

void neko_view_init ( neko_view self,
gp_size  x,
gp_size  y,
gp_size  w,
gp_size  h,
const char *  name 
)

Initialize a view.

Parameters
selfA view to initialize.
xA x offset of the view on a screen.
yA y offset of the view on a screen.
wA view width in pixels.
hA view height in pixels.
nameA view name.

◆ neko_view_is_focused()

int neko_view_is_focused ( neko_view self)

Returns true if view is focused.

Parameters
selfA neko view.
Returns
Returns true if view is focused.

◆ neko_view_pixmap()

gp_pixmap * neko_view_pixmap ( neko_view self)

Returns a pixmap for the view.

Parameters
selfA neko view.

◆ neko_view_repaint()

void neko_view_repaint ( neko_view self)

Request a view repaint.

Needs to be called after resize on view(s) shown on the screen(s).

Parameters
selfA view to be repainted.

◆ neko_view_resize()

void neko_view_resize ( neko_view self,
gp_size  w,
gp_size  h 
)

Resizes the view recursively along with all slots.

Parameters
selfA neko view.
wNew width.
hNew height.

◆ neko_view_show()

void neko_view_show ( neko_view self)

Switches a view shown on a display.

Before new view is shown current while, if any, must be hidden with neko_view_hide().

Parameters
selfA view to be shown.

◆ neko_view_slot_exit()

static void neko_view_slot_exit ( neko_view self)
inlinestatic

Child did exit.

This is called by a child when it did exit. The view should replace the child with a different one (if possible) in the handler.

Parameters
selfA neko view.

Definition at line 202 of file neko_view.h.

References neko_view::slot, and neko_view::slot_exit.

◆ neko_view_slot_put()

void neko_view_slot_put ( neko_view self,
neko_view_slot slot 
)

Fills in a slot in a neko view.

Sets a new view slot content, possibly replaces currently shown content. If slot is NULL the view becomes empty.

Parameters
selfA neko view.
slotA new neko view slot content to be shonw in the view.

◆ neko_view_slot_rem()

void neko_view_slot_rem ( neko_view self)

Removes a slot from a view.

Parameters
selfA neko view.

◆ neko_view_update_rect()

void neko_view_update_rect ( neko_view self,
gp_coord  x,
gp_coord  y,
gp_size  w,
gp_size  h 
)

Update rectangle in the view on the screen.

This is called by the child when content needs to be updated from the view pixmap and painted on the screen.

Parameters
selfA neko view.