libxputty 0.1
Loading...
Searching...
No Matches
Data Structures | Typedefs | Enumerations | Functions
xwidget.h File Reference

This file contains definitions and structs used on all platforms. Platform specific definitions are located in xwidget-platform.h Xlib compatibility definitions for MSWindows are located in xputty-mswin.h. More...

Go to the source code of this file.

Data Structures

struct  Func_t
 Func_t - struct to hold all supported event callbacks. More...
 
struct  Resize_t
 Resize_t - struct used to resize child widgets. More...
 
struct  Widget_t
 Widget_t - struct to hold the basic Widget_t info. More...
 

Typedefs

typedef void(* vfunc) (void *widget, void *event, Xputty *main, void *user_data)
 *vfunc - function pointer to connect Xevents from the main loop to Widget_t
 
typedef void(* evfunc) (void *widget, void *event, void *user_data)
 *evfunc - function pointer to connect Xevents from a Widget_t to a event handler
 
typedef void(* xevfunc) (void *widget, void *user_data)
 *xevfunc - function pointer to connect XEvents from a Widget_t to a event handler
 

Enumerations

enum  EventType {
  EXPOSE = 1 , CONFIGURE , ENTER , LEAVE ,
  ADJ_INTERN , VALUE_CHANGED , USER , MEM_FREE_CB ,
  CONFIGURE_NOTIFY , MAP_NOTIFY , UNMAP_NOTIFY , DIALOG_RESPONSE ,
  BUTTON_PRESS , BUTTON_RELEASE , POINTER_MOTION , KEY_PRESS ,
  KEY_RELEASE
}
 EventType - enum to hold identifier for all supported event callbacks
Events could be connected to a handler by using this identifier. More...
 
enum  WidgetType {
  WT_NONE , WT_WINDOW , WT_WIDGET , WT_BUTTON ,
  WT_ON_OFF_BUTTON , WT_TOGGLE_BUTTON , WT_IMAGE_TOGGLE_BUTTON , WT_SWITCH_IMAGE_TOGGLE_BUTTON ,
  WT_CHECK_BUTTON , WT_CHECK_BOX , WT_COMBOBOX , WT_FILE_DIALOG ,
  WT_KNOB , WT_IMAGE_KNOB , WT_LABEL , WT_LISTBOX_VIEWPORT ,
  WT_LISTBOX , WT_LISTBOX_ENTRY , WT_LISTVIEW_VIEWPORT , WT_LISTVIEW ,
  WT_MENU , WT_MENU_VIEWPORT , WT_MENU_ITEM , WT_MENU_CHECK_ITEM ,
  WT_MENU_RADIO_ITEM , WT_MESSAGE_DIALOG , WT_VMETER , WT_VMETER_SCALE ,
  WT_HMETER , WT_HMETER_SCALE , WT_MIDI_KEYBOARD , WT_PLAYHEAD ,
  WT_VSLIDER , WT_HSLIDER , WT_TOOLTIP , WT_TUNER ,
  WT_VALUEDISPLAY , WT_TEXT_ENTRY
}
 WidgetType - enum describing the kind of the widget (button, menu, ...)
The widget_type member can be used to identify the source widget e.g. in the messageloop. More...
 
enum  Gravity {
  NORTHWEST , NORTHEAST , SOUTHWEST , SOUTHEAST ,
  SOUTHCENTER , EASTWEST , EASTNORTH , EASTSOUTH ,
  WESTNORTH , WESTSOUTH , CENTER , ASPECT ,
  FIXEDSIZE , MENUITEM , NONE
}
 Gravity - enum to indicate how to resize a widget. More...
 
enum  {
  IS_WIDGET = 1<<0 , IS_WINDOW = 1<<1 , IS_POPUP = 1<<2 , IS_RADIO = 1<<3 ,
  IS_TOOLTIP = 1<<4 , USE_TRANSPARENCY = 1<<5 , HAS_FOCUS = 1<<6 , HAS_POINTER = 1<<7 ,
  HAS_TOOLTIP = 1<<8 , HAS_MEM = 1<<9 , NO_AUTOREPEAT = 1<<10 , FAST_REDRAW = 1<<11 ,
  HIDE_ON_DELETE = 1<<12 , REUSE_IMAGE = 1<<13 , NO_PROPAGATE = 1<<14 , IS_SUBMENU = 1<<15 ,
  DONT_PROPAGATE = 1<<16
}
 anonymous enum - flags to set Widget_t propertys More...
 

Functions

Widget_tcreate_window (Xputty *app, Window win, int x, int y, int width, int height)
 *create_window - create a Window
You need to create as least minimun one Window to get started.
The first created Window is the top_level_widget()
A Window could be created on the DefaultRootWindow() or embeded into a other XWindow
 
Widget_tcreate_widget (Xputty *app, Widget_t *win, int x, int y, int width, int height)
 *create_widget - create a widget
A Widget_t could only be created as child of a other Widget_t
To create a Widget_t you need to create a Widget_t with create_window() before.
 
void connect_func (void(**event)(), void(*handler)())
 connect_func - connect a event with a handler without type check. For supported events see: Func_t
 
void widget_set_title (Widget_t *w, const char *title)
 widget_set_title - set window title for a Widget_t
 
void widget_show (Widget_t *w)
 widget_show - map/show widget
 
void pop_widget_show_all (Widget_t *w)
 pop_widget_show_all - map/show popup widget with all it's childs
 
void submenu_widget_show_all (Widget_t *w)
 submenu_widget_show_all - map/show submenu Widget_t with all childs
 
void widget_hide (Widget_t *w)
 widget_hide - unmap/hide a Widget_t
 
void widget_hide_all (Widget_t *w)
 widget_hide_all - unmap/hide all Widget_t from app
 
void widget_show_all (Widget_t *w)
 widget_show_all - map/show Widget_t with all childs
 
void show_tooltip (Widget_t *wid)
 show_tooltip - check if a Widget_t have a tooltip, and show it, if a tooltip is available.
 
void hide_tooltip (Widget_t *wid)
 hide_tooltip - check if a Widget_t have a tooltip, and hide it, if a tooltip is mapped.
 
Widget_tget_toplevel_widget (Xputty *main)
 *get_toplevel_widget - get pointer to the top level Widget_t
 
void quit (Widget_t *w)
 quit - exit the main loop
 
void quit_widget (Widget_t *w)
 quit_widget - remove a widget from the processing loop
 
void transparent_draw (void *wid, void *user_data)
 transparent_draw - copy parent surface to child surface
you usaualy didn't need to call this, it's used automaticaly when a Widget_t have set the flag USE_TRANSPARENCY
this is the default setting for Widget_t
 
void widget_draw (void *w_, void *user_data)
 widget_draw - redraw only the widget,not the child widgets
 
void resize_childs (Widget_t *wid)
 resize_childs - intern check if child widgets needs resizing
 
void widget_reset_scale (Widget_t *w)
 widget_reset_scale - used to reset scaling mode after a image surface is drawn to the Widget_t surface with widget_set_scale()
 
void widget_set_scale (Widget_t *w)
 widget_set_scale - set scaling mode to scale a image surface to the size of the Widget_t surface
 
void destroy_widget (Widget_t *w, Xputty *main)
 destroy_widget - destroy a widget
When a Widget_t receive a destroy_widget() call, it will propagate that to all childs in it's Childlist_t. So all childs get destroyed before the Widget_t itself close.
 
void widget_event_loop (void *w_, void *event, Xputty *main, void *user_data)
 widget_event_loop - the internal widget event loop
 
void send_configure_event (Widget_t *w, int x, int y, int width, int height)
 send_configure_event - send a ConfigureNotify to Widget_t
used to resize a Widget_t
 
void send_button_press_event (Widget_t *w)
 send_button_press_event - send ButtonPress event to Widget_t
simulate a BUTTON_PRESS Event
 
void send_button_release_event (Widget_t *w)
 send_button_release_event - send ButtonRelease event to Widget_t
simulate a BUTTON_RELEASE Event
 
void send_systray_message (Widget_t *w)
 send_systray_message - request a systray icon for Widget_t
currently not working
 
void expose_widget (Widget_t *w)
 expose_widgets - send a expose event (EXPOSE) to a Widget_t
 
int key_mapping (Display *dpy, XKeyEvent *xkey)
 _key_mapping - modifier key's mapped to a integer value
 
const char * widget_type_name (Widget_t *w)
 widget_type_name - textual representation of (Widget_t*)->widget_type
 
void strdecode (char *target, const char *needle, const char *replacement)
 strdecode - replace string in char*
 
void widget_set_dnd_aware (Widget_t *w)
 widget_set_dnd_aware - allow drag and drop for on Widget_t
 
void widget_set_dnd_unaware (Widget_t *w)
 widget_set_dnd_unaware - disable drag and drop for on Widget_t
 
void handle_drag_data (Widget_t *w, XEvent *event)
 handle_drag_data - handle recived drag data
 
void handle_dnd_enter (Xputty *main, XEvent *event)
 handle_drag_enter - handle drag event enter the Widget_t
 
void send_dnd_finished_event (Widget_t *w, XEvent *event)
 send_dnd_finished_event - notify the drag sender that the event is handled
 
void send_dnd_status_event (Widget_t *w, XEvent *event)
 send_dnd_status_event - notify the drag sender that prepared to recive the event
 
void copy_to_clipboard (Widget_t *w, char *text, int size)
 copy_to_clipboard - send textbuffer to clipboard
 
void send_to_clipboard (Widget_t *w, XEvent *event)
 send_to_clipboard - send textbuffer to clipboard on request
 
int have_paste (Widget_t *w)
 have_paste - check if clipboard contain a textbuffer
 
void request_paste_from_clipboard (Widget_t *w)
 request_paste_from_clipboard - request textbuffer from clipboard
 
void receive_paste_from_clipboard (Widget_t *w, XEvent *event)
 receive_paste_from_clipboard - receive textbuffer from clipboard
 

Detailed Description

This file contains definitions and structs used on all platforms. Platform specific definitions are located in xwidget-platform.h Xlib compatibility definitions for MSWindows are located in xputty-mswin.h.

Definition in file xwidget.h.

Typedef Documentation

◆ evfunc

typedef void(* evfunc) (void *widget, void *event, void *user_data)

*evfunc - function pointer to connect Xevents from a Widget_t to a event handler

Parameters
*widget- void pointer to the Widget_t
*event- void pointer to the XEvent
*user_data- void pointer to attached user_data, maybe NULL

Definition at line 67 of file xwidget.h.

◆ vfunc

typedef void(* vfunc) (void *widget, void *event, Xputty *main, void *user_data)

*vfunc - function pointer to connect Xevents from the main loop to Widget_t

Parameters
*widget- void pointer to the Widget_t
*main- pointer to Xputty main struct running the loop
*event- void pointer to the XEvent
*user_data- void pointer to attached user_data, maybe NULL

Definition at line 58 of file xwidget.h.

◆ xevfunc

typedef void(* xevfunc) (void *widget, void *user_data)

*xevfunc - function pointer to connect XEvents from a Widget_t to a event handler

Parameters
*widget- void pointer to the widget
*user_data- void pointer to attached user_data, maybe NULL

Definition at line 76 of file xwidget.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

anonymous enum - flags to set Widget_t propertys

Parameters
IS_WIDGET- Widget_t is a sub widget
IS_WINDOW- Widget_t has no Widget_t parent
IS_POPUP- Widget_t is a pop up widget
IS_RADIO- Widget_t is part of a radio group
USE_TRANSPARENCY- Widget_t need transparent draw (buffer)
HAS_FOCUS- Mouse pointer is above Widget_t
HAS_POINTER- Mouse pointer is pressed on Widget_t
HAS_TOOLTIP- Widget_t have tooltip
HAS_MEM- Widget_t have mem to be released
Enumerator
IS_WIDGET 

Widget_t is a sub widget

IS_WINDOW 

Widget_t has no Widget_t parent

IS_POPUP 

Widget_t is a pop up widget

IS_RADIO 

Widget_t is part of a radio group

IS_TOOLTIP 

Widget_t is a tooltip widget

USE_TRANSPARENCY 

Widget_t need transparent draw (buffer)

HAS_FOCUS 

Mouse pointer is above Widget_t

HAS_POINTER 

Mouse pointer is pressed on Widget_t

HAS_TOOLTIP 

Widget_t have tooltip

HAS_MEM 

Widget_t have mem to be released

NO_AUTOREPEAT 

Widget_t didn't receive autorepeated keys

FAST_REDRAW 

Widget_t need fast redrawing

HIDE_ON_DELETE 

Hide Widget_t instead delete on "WM_DELETE_WINDOW"

REUSE_IMAGE 

Widget_t reuse a surface from a other Widget_t

NO_PROPAGATE 

Widget_t didn't receive redraw events on propagate

IS_SUBMENU 

Widget_t is a sub Widget_t from a Popup Widget_t

DONT_PROPAGATE 

Widget_t didn't send redraw events to child widgets

Definition at line 386 of file xwidget.h.

386 {
388 IS_WIDGET = 1<<0,
390 IS_WINDOW = 1<<1,
392 IS_POPUP = 1<<2,
394 IS_RADIO = 1<<3,
396 IS_TOOLTIP = 1<<4,
398 USE_TRANSPARENCY = 1<<5,
400 HAS_FOCUS = 1<<6,
402 HAS_POINTER = 1<<7,
404 HAS_TOOLTIP = 1<<8,
406 HAS_MEM = 1<<9,
408 NO_AUTOREPEAT = 1<<10,
410 FAST_REDRAW = 1<<11,
412 HIDE_ON_DELETE = 1<<12,
414 REUSE_IMAGE = 1<<13,
416 NO_PROPAGATE = 1<<14,
418 IS_SUBMENU = 1<<15,
420 DONT_PROPAGATE = 1<<16,
421
422};
@ IS_TOOLTIP
Definition xwidget.h:396
@ IS_WIDGET
Definition xwidget.h:388
@ HIDE_ON_DELETE
Definition xwidget.h:412
@ FAST_REDRAW
Definition xwidget.h:410
@ HAS_POINTER
Definition xwidget.h:402
@ NO_AUTOREPEAT
Definition xwidget.h:408
@ USE_TRANSPARENCY
Definition xwidget.h:398
@ HAS_MEM
Definition xwidget.h:406
@ HAS_TOOLTIP
Definition xwidget.h:404
@ IS_RADIO
Definition xwidget.h:394
@ HAS_FOCUS
Definition xwidget.h:400
@ NO_PROPAGATE
Definition xwidget.h:416
@ IS_WINDOW
Definition xwidget.h:390
@ DONT_PROPAGATE
Definition xwidget.h:420
@ REUSE_IMAGE
Definition xwidget.h:414
@ IS_POPUP
Definition xwidget.h:392
@ IS_SUBMENU
Definition xwidget.h:418

◆ EventType

enum EventType

EventType - enum to hold identifier for all supported event callbacks
Events could be connected to a handler by using this identifier.

Parameters
EXPOSE- (xevfunc) expose_callback(void * widget, void user_data)
CONFIGURE- (xevfunc) configure_callback(void * widget, void user_data)
ENTER- (xevfunc) enter_callback(void * widget, void user_data)
LEAVE- (xevfunc) leave_callback(void * widget, void user_data)
ADJ_INTERN- (xevfunc) adj_callback(void * widget, void user_data)
VALUE_CHANGED- (xevfunc) value_changed_callback(void * widget, void user_data)
USER- (xevfunc) user_callback(void * widget, void user_data)
MEM_FREE_CB- (xevfunc) mem_free_callback(void * widget, void user_data)
CONFIGURE_NOTIFY- (xevfunc) configure_notify_callback(void * widget, void user_data)
MAP_NOTIFY- (xevfunc) map_notify_callback(void * widget, void user_data)
UNMAP_NOTIFY- (xevfunc) unmap_notify_callback(void * widget, void user_data)
DIALOG_RESPONS- (xevfunc) dialog_callback(void * widget, void user_data)
BUTTON_PRESS- (evfunc) button_press_callback(void * widget, void * event, void user_data)
BUTTON_RELEASE- (evfunc) button_release_callback(void * widget, void * event, void user_data)
POINTER_MOTION- (evfunc) motion_callback(void * widget, void * event, void user_data)
KEY_PRESS- (evfunc) key_press_callback(void * widget, void * event, void user_data)
KEY_RELEASE- (evfunc) key_release_callback(void * widget, void * event, void user_data)
Enumerator
EXPOSE 
CONFIGURE 
ENTER 
LEAVE 
ADJ_INTERN 
VALUE_CHANGED 
USER 
MEM_FREE_CB 
CONFIGURE_NOTIFY 
MAP_NOTIFY 
UNMAP_NOTIFY 
DIALOG_RESPONSE 
BUTTON_PRESS 
BUTTON_RELEASE 
POINTER_MOTION 
KEY_PRESS 
KEY_RELEASE 

Definition at line 131 of file xwidget.h.

131 {
132 EXPOSE = 1,
133 CONFIGURE,
134 ENTER,
135 LEAVE,
138 USER,
147 KEY_PRESS,
149} EventType;
EventType
EventType - enum to hold identifier for all supported event callbacks Events could be connected to ...
Definition xwidget.h:131
@ UNMAP_NOTIFY
Definition xwidget.h:142
@ MAP_NOTIFY
Definition xwidget.h:141
@ POINTER_MOTION
Definition xwidget.h:146
@ KEY_PRESS
Definition xwidget.h:147
@ CONFIGURE_NOTIFY
Definition xwidget.h:140
@ CONFIGURE
Definition xwidget.h:133
@ KEY_RELEASE
Definition xwidget.h:148
@ VALUE_CHANGED
Definition xwidget.h:137
@ ADJ_INTERN
Definition xwidget.h:136
@ ENTER
Definition xwidget.h:134
@ MEM_FREE_CB
Definition xwidget.h:139
@ EXPOSE
Definition xwidget.h:132
@ LEAVE
Definition xwidget.h:135
@ USER
Definition xwidget.h:138
@ BUTTON_RELEASE
Definition xwidget.h:145
@ BUTTON_PRESS
Definition xwidget.h:144
@ DIALOG_RESPONSE
Definition xwidget.h:143

◆ Gravity

enum Gravity

Gravity - enum to indicate how to resize a widget.

Parameters
NORTHWEST- Widget_t adjust nord/west
NORTHEAST- Widget_t adjust nord/east
SOUTHWEST- Widget_t adjust south/west
SOUTHEAST- Widget_t adjust south/east
CENTER- Widget_t adjust centered
ASPECT- Widget_t adjust in a aspect frame
NONE- Widget_t request no adjustment in frame
Enumerator
NORTHWEST 

Widget_t adjust nord/west

NORTHEAST 

Widget_t adjust nord/east

SOUTHWEST 

Widget_t adjust south/west

SOUTHEAST 

Widget_t adjust south/east

SOUTHCENTER 

Widget_t adjust south/east

EASTWEST 

Widget_t adjust east/west

EASTNORTH 

Widget_t adjust east/north

EASTSOUTH 

Widget_t adjust east/south

WESTNORTH 

Widget_t adjust west/north

WESTSOUTH 

Widget_t adjust west/south

CENTER 

Widget_t adjust centered

ASPECT 

Widget_t adjust in a aspect frame

FIXEDSIZE 

Widget_t has fixed size

MENUITEM 

Widget_t adjust in a aspect frame

NONE 

Widget_t request no adjustment in frame

Definition at line 298 of file xwidget.h.

298 {
300 NORTHWEST ,
302 NORTHEAST ,
304 SOUTHWEST ,
306 SOUTHEAST ,
310 EASTWEST ,
312 EASTNORTH ,
314 EASTSOUTH ,
316 WESTNORTH ,
318 WESTSOUTH ,
320 CENTER ,
322 ASPECT ,
324 FIXEDSIZE ,
326 MENUITEM ,
328 NONE ,
329}Gravity;
Gravity
Gravity - enum to indicate how to resize a widget.
Definition xwidget.h:298
@ SOUTHEAST
Definition xwidget.h:306
@ CENTER
Definition xwidget.h:320
@ EASTSOUTH
Definition xwidget.h:314
@ WESTSOUTH
Definition xwidget.h:318
@ EASTWEST
Definition xwidget.h:310
@ SOUTHWEST
Definition xwidget.h:304
@ MENUITEM
Definition xwidget.h:326
@ SOUTHCENTER
Definition xwidget.h:308
@ ASPECT
Definition xwidget.h:322
@ FIXEDSIZE
Definition xwidget.h:324
@ NORTHEAST
Definition xwidget.h:302
@ NONE
Definition xwidget.h:328
@ NORTHWEST
Definition xwidget.h:300
@ WESTNORTH
Definition xwidget.h:316
@ EASTNORTH
Definition xwidget.h:312

◆ WidgetType

enum WidgetType

WidgetType - enum describing the kind of the widget (button, menu, ...)
The widget_type member can be used to identify the source widget e.g. in the messageloop.

Parameters
WT_NONE- (unitialized or error)
WT_WINDOW- create_window()
WT_WIDGET- create_widget()
WT_BUTTON- add_button()
WT_ON_OFF_BUTTON- add_on_off_button()
WT_TOGGLE_BUTTON- add_toggle_button()
WT_IMAGE_TOGGLE_BUTTON- add_image_toggle_button()
WT_SWITCH_IMAGE_TOGGLE_BUTTON- add_switch_image_button()
WT_CHECK_BUTTON- add_check_box()
WT_CHECK_BOX- add_check_box()
WT_COMBOBOX- add_combobox()
WT_FILE_DIALOG- open_file_dialog()
WT_KNOB- add_knob()
WT_IMAGE_KNOB- add_image_knob()
WT_LABEL- add_label()
WT_LISTBOX- add_listbox()
WT_LISTBOX_VIEWPORT- create_listbox_viewport()
WT_LISTBOX_ENTRY- listbox_add_entry()
WT_LISTVIEW- add_listview()
WT_LISTVIEW_VIEWPORT- create_listbox_viewport()
WT_MENU- create_menu(), used by WT_COMBOBOX
WT_MENU_VIEWPORT- create_viewport()
WT_MENU_ITEM- menu_add_item()
WT_MENU_CHECK_ITEM- menu_add_check_item()
WT_MENU_RADIO_ITEM- menu_add_radio_item()
WT_MESSAGE_DIALOG- open_message_dialog()
WT_TEXT_ENTRY- create_entry_box(), used by WT_MESSAGE_DIALOG
WT_VMETER- add_vmeter()
WT_VMETER_SCALE- add_vmeter()
WT_HMETER- add_hmeter()
WT_HMETER_SCALE- add_hmeter()
WT_MIDI_KEYBOARD- open_midi_keyboard()
WT_PLAYHEAD- add_playhead()
WT_VSLIDER- add_vslider()
WT_HSLIDER- add_hslider()
WT_TOOLTIP- add_tooltip()
WT_TUNER- add_tuner()
WT_VALUEDISPLAY- add_valuedisplay()
Enumerator
WT_NONE 
WT_WINDOW 
WT_WIDGET 
WT_BUTTON 
WT_ON_OFF_BUTTON 
WT_TOGGLE_BUTTON 
WT_IMAGE_TOGGLE_BUTTON 
WT_SWITCH_IMAGE_TOGGLE_BUTTON 
WT_CHECK_BUTTON 
WT_CHECK_BOX 
WT_COMBOBOX 
WT_FILE_DIALOG 
WT_KNOB 
WT_IMAGE_KNOB 
WT_LABEL 
WT_LISTBOX_VIEWPORT 
WT_LISTBOX 
WT_LISTBOX_ENTRY 
WT_LISTVIEW_VIEWPORT 
WT_LISTVIEW 
WT_MENU 
WT_MENU_VIEWPORT 
WT_MENU_ITEM 
WT_MENU_CHECK_ITEM 
WT_MENU_RADIO_ITEM 
WT_MESSAGE_DIALOG 
WT_VMETER 
WT_VMETER_SCALE 
WT_HMETER 
WT_HMETER_SCALE 
WT_MIDI_KEYBOARD 
WT_PLAYHEAD 
WT_VSLIDER 
WT_HSLIDER 
WT_TOOLTIP 
WT_TUNER 
WT_VALUEDISPLAY 
WT_TEXT_ENTRY 

Definition at line 195 of file xwidget.h.

195 {
196 WT_NONE,
197 WT_WINDOW,
198 WT_WIDGET,
199 WT_BUTTON,
208 WT_KNOB,
210 WT_LABEL,
216 WT_MENU,
222 WT_VMETER,
224 WT_HMETER,
231 WT_TUNER,
234} WidgetType;
WidgetType
WidgetType - enum describing the kind of the widget (button, menu, ...) The widget_type member can ...
Definition xwidget.h:195
@ WT_LISTBOX
Definition xwidget.h:212
@ WT_LABEL
Definition xwidget.h:210
@ WT_LISTVIEW_VIEWPORT
Definition xwidget.h:214
@ WT_IMAGE_TOGGLE_BUTTON
Definition xwidget.h:202
@ WT_LISTBOX_ENTRY
Definition xwidget.h:213
@ WT_LISTVIEW
Definition xwidget.h:215
@ WT_NONE
Definition xwidget.h:196
@ WT_VALUEDISPLAY
Definition xwidget.h:232
@ WT_TOOLTIP
Definition xwidget.h:230
@ WT_WINDOW
Definition xwidget.h:197
@ WT_SWITCH_IMAGE_TOGGLE_BUTTON
Definition xwidget.h:203
@ WT_COMBOBOX
Definition xwidget.h:206
@ WT_TUNER
Definition xwidget.h:231
@ WT_HSLIDER
Definition xwidget.h:229
@ WT_MESSAGE_DIALOG
Definition xwidget.h:221
@ WT_VMETER
Definition xwidget.h:222
@ WT_CHECK_BOX
Definition xwidget.h:205
@ WT_ON_OFF_BUTTON
Definition xwidget.h:200
@ WT_PLAYHEAD
Definition xwidget.h:227
@ WT_MIDI_KEYBOARD
Definition xwidget.h:226
@ WT_VSLIDER
Definition xwidget.h:228
@ WT_CHECK_BUTTON
Definition xwidget.h:204
@ WT_MENU_VIEWPORT
Definition xwidget.h:217
@ WT_HMETER
Definition xwidget.h:224
@ WT_BUTTON
Definition xwidget.h:199
@ WT_KNOB
Definition xwidget.h:208
@ WT_MENU_RADIO_ITEM
Definition xwidget.h:220
@ WT_MENU_CHECK_ITEM
Definition xwidget.h:219
@ WT_TEXT_ENTRY
Definition xwidget.h:233
@ WT_MENU_ITEM
Definition xwidget.h:218
@ WT_HMETER_SCALE
Definition xwidget.h:225
@ WT_WIDGET
Definition xwidget.h:198
@ WT_VMETER_SCALE
Definition xwidget.h:223
@ WT_LISTBOX_VIEWPORT
Definition xwidget.h:211
@ WT_TOGGLE_BUTTON
Definition xwidget.h:201
@ WT_IMAGE_KNOB
Definition xwidget.h:209
@ WT_FILE_DIALOG
Definition xwidget.h:207
@ WT_MENU
Definition xwidget.h:216

Function Documentation

◆ connect_func()

void connect_func ( void(**)()  event,
void(*)()  handler 
)

connect_func - connect a event with a handler without type check. For supported events see: Func_t

Parameters
**event- the event to connect
*handler- the handler to handle the event

Definition at line 352 of file xwidget.c.

352 {
353 debug_print("address of a is: %p\n", (void*)event);
354 debug_print("address of b is: %p\n", (void*)handler);
355 *event = handler;
356 debug_print("address of a is: %p\n", (void*)(*event));
357}

◆ copy_to_clipboard()

void copy_to_clipboard ( Widget_t w,
char *  text,
int  size 
)

copy_to_clipboard - send textbuffer to clipboard

Parameters
w- the Widget_t to send the event
text- the text buffer to send to clipboard
size- the size of the buffer to send

Definition at line 586 of file xwidget-linux.c.

586 {
587 XSetSelectionOwner (w->app->dpy, w->app->selection, w->widget, 0);
588 if (XGetSelectionOwner (w->app->dpy, w->app->selection) != w->widget) return;
589 free(w->app->ctext);
590 w->app->ctext = NULL;
591 w->app->ctext = (unsigned char*)strndup(text, size);
592 w->app->csize = size;
593}
Window widget
Definition xwidget.h:469
Xputty * app
Definition xwidget.h:465
Display * dpy
Definition xputty.h:232
Atom selection
Definition xputty.h:278
int csize
Definition xputty.h:252
unsigned char * ctext
Definition xputty.h:244

References Widget_t::app, Xputty::csize, Xputty::ctext, Xputty::dpy, Xputty::selection, and Widget_t::widget.

◆ create_widget()

Widget_t * create_widget ( Xputty app,
Widget_t win,
int  x,
int  y,
int  width,
int  height 
)

*create_widget - create a widget
A Widget_t could only be created as child of a other Widget_t
To create a Widget_t you need to create a Widget_t with create_window() before.

Parameters
*app- pointer to the Xputty *main struct to use
*win- pointer to the Parrent Widget_t
x,y,width,height- the position/geometry to create the widget
Returns
Widget_t* - pointer to the Widget_t struct

Definition at line 265 of file xwidget.c.

266 {
267
268 Widget_t *w = (Widget_t*)malloc(sizeof(Widget_t));
269 assert(w != NULL);
270 debug_print("assert(w)\n");
271 memset(w, 0, sizeof(Widget_t));
272 w->image = NULL;
273
275 w->flags &= ~NO_AUTOREPEAT;
276 w->flags &= ~FAST_REDRAW;
277 w->flags &= ~HIDE_ON_DELETE;
278 w->flags &= ~REUSE_IMAGE;
279 w->flags &= ~NO_PROPAGATE;
280 w->flags &= ~IS_SUBMENU;
281 w->flags &= ~DONT_PROPAGATE;
282 w->app = app;
283 w->parent = parent;
284 w->parent_struct = NULL;
285 w->private_struct = NULL;
286 w->label = NULL;
287 memset(w->input_label, 0, 32 * (sizeof w->input_label[0]));
288 w->state = 0;
289#ifdef __linux__
290 w->double_click = 0;
291#endif
292 w->data = 0;
293 w->x = x;
294 w->y = y;
295 w->width = width;
296 w->height = height;
297 w->scale.gravity = CENTER;
298 w->scale.init_width = width;
299 w->scale.init_height = height;
300 w->scale.init_x = x;
301 w->scale.init_y = y;
302 w->scale.scale_x = 0.0;
303 w->scale.scale_y = 0.0;
304 w->scale.cscale_x = 1.0;
305 w->scale.cscale_y = 1.0;
306 w->scale.rcscale_x = 1.0;
307 w->scale.rcscale_y = 1.0;
308 w->scale.ascale = 1.0;
309 w->adj_x = NULL;
310 w->adj_y = NULL;
311 w->adj = NULL;
312 w->color_scheme = (XColor_t*)malloc(sizeof(XColor_t));
313 memcpy(w->color_scheme, app->color_scheme, sizeof (struct XColor_t));
314 w->childlist = (Childlist_t*)malloc(sizeof(Childlist_t));
315 assert(w->childlist != NULL);
317 childlist_add_child(parent->childlist, w);
340
341 //XMapWindow(app->dpy, w->widget);
342 //debug_print("size of Widget_t = %lld\n", sizeof(struct Widget_t));
343
344 os_create_widget_window_and_surface(w, app, parent, x, y, width, height);
346#ifdef __linux__ // childlist already set up
348#endif
349 return w;
350}
Childlist_t - struct to hold a Widget_t child list Xputty main holds a list of any Widget_t created...
Definition xchildlist.h:49
xevfunc configure_notify_callback
Definition xwidget.h:93
evfunc button_release_callback
Definition xwidget.h:101
xevfunc configure_callback
Definition xwidget.h:86
xevfunc map_notify_callback
Definition xwidget.h:94
xevfunc unmap_notify_callback
Definition xwidget.h:95
xevfunc expose_callback
Definition xwidget.h:85
evfunc key_release_callback
Definition xwidget.h:105
evfunc key_press_callback
Definition xwidget.h:104
xevfunc visibiliy_change_callback
Definition xwidget.h:98
evfunc double_click_callback
Definition xwidget.h:102
xevfunc leave_callback
Definition xwidget.h:88
xevfunc adj_callback
Definition xwidget.h:89
xevfunc value_changed_callback
Definition xwidget.h:90
xevfunc dnd_notify_callback
Definition xwidget.h:97
xevfunc user_callback
Definition xwidget.h:91
xevfunc mem_free_callback
Definition xwidget.h:92
evfunc motion_callback
Definition xwidget.h:103
xevfunc enter_callback
Definition xwidget.h:87
evfunc button_press_callback
Definition xwidget.h:100
xevfunc dialog_callback
Definition xwidget.h:96
int init_height
Definition xwidget.h:355
float scale_y
Definition xwidget.h:359
float ascale
Definition xwidget.h:369
float cscale_y
Definition xwidget.h:363
Gravity gravity
Definition xwidget.h:347
float rcscale_x
Definition xwidget.h:365
float cscale_x
Definition xwidget.h:361
int init_width
Definition xwidget.h:353
int init_y
Definition xwidget.h:351
int init_x
Definition xwidget.h:349
float rcscale_y
Definition xwidget.h:367
float scale_x
Definition xwidget.h:357
Widget_t - struct to hold the basic Widget_t info.
Definition xwidget.h:457
int y
Definition xwidget.h:519
Resize_t scale
Definition xwidget.h:525
Adjustment_t * adj_y
Definition xwidget.h:495
vfunc event_callback
Definition xwidget.h:479
Adjustment_t * adj_x
Definition xwidget.h:493
int width
Definition xwidget.h:521
XColor_t * color_scheme
Definition xwidget.h:467
cairo_surface_t * image
Definition xwidget.h:491
Adjustment_t * adj
Definition xwidget.h:497
void * parent
Definition xwidget.h:471
int x
Definition xwidget.h:517
int state
Definition xwidget.h:511
Childlist_t * childlist
Definition xwidget.h:499
int data
Definition xwidget.h:509
xevfunc xpaste_callback
Definition xwidget.h:533
long long flags
Definition xwidget.h:461
char input_label[32]
Definition xwidget.h:459
void * private_struct
Definition xwidget.h:475
const char * label
Definition xwidget.h:463
Time double_click
Definition xwidget.h:506
void * parent_struct
Definition xwidget.h:473
int height
Definition xwidget.h:523
Func_t func
Definition xwidget.h:481
XColor_t - the Widget_t Color struct XColor_t could be used for theming you Widget_t set.
Definition xcolor.h:105
XColor_t * color_scheme
Definition xputty.h:234
Childlist_t * childlist
Definition xputty.h:230
void childlist_add_child(Childlist_t *childlist, Widget_t *child)
childlist_add_child - internal use to add a child to the Childlist_t You usually didn't need to cal...
Definition xchildlist.c:42
void childlist_init(Childlist_t *childlist)
childlist_init - internal use to allocate the array to min size You usually didn't need to call thi...
Definition xchildlist.c:25
void os_widget_event_loop(void *w_, void *event, Xputty *main, void *user_data)
os_widget_event_loop - the Widget_t event loop on windows all messges goes into WndProc,...
void os_transparent_draw(void *w_, void *user_data)
os_transparent_draw - Draw the Widget_t to the back buffer
void os_create_widget_window_and_surface(Widget_t *w, Xputty *app, Widget_t *parent, int x, int y, int width, int height)
os_create_main_widget_and_surface - create a Widget_t with a acairo surface this function is used mai...
void os_adjustment_callback(void *w_, void *user_data)
os_adjustment_callback - called when a adjustment value have changed used internal for redraw the Wid...
void create_cairo_context_and_buffer(Widget_t *w)
Definition xwidget.c:249
void configure_event(void *w_, void *user_data)
Definition xwidget.c:128
void _dummy_callback(void *w_, void *user_data)
_dummy1_callback - default debuging callback for xevfunc's
void _dummy1_callback(void *w_, void *_data, void *user_data)
_dummy1_callback - default debuging callback for evfunc's

References _dummy1_callback(), _dummy_callback(), Widget_t::adj, Func_t::adj_callback, Widget_t::adj_x, Widget_t::adj_y, Widget_t::app, Resize_t::ascale, Func_t::button_press_callback, Func_t::button_release_callback, CENTER, Xputty::childlist, Widget_t::childlist, childlist_add_child(), childlist_init(), Xputty::color_scheme, Widget_t::color_scheme, Func_t::configure_callback, configure_event(), Func_t::configure_notify_callback, create_cairo_context_and_buffer(), Resize_t::cscale_x, Resize_t::cscale_y, Widget_t::data, Func_t::dialog_callback, Func_t::dnd_notify_callback, Widget_t::double_click, Func_t::double_click_callback, Func_t::enter_callback, Widget_t::event_callback, Func_t::expose_callback, Widget_t::flags, Widget_t::func, Resize_t::gravity, Widget_t::height, Widget_t::image, Resize_t::init_height, Resize_t::init_width, Resize_t::init_x, Resize_t::init_y, Widget_t::input_label, IS_WIDGET, Func_t::key_press_callback, Func_t::key_release_callback, Widget_t::label, Func_t::leave_callback, Func_t::map_notify_callback, Func_t::mem_free_callback, Func_t::motion_callback, os_adjustment_callback(), os_create_widget_window_and_surface(), os_transparent_draw(), os_widget_event_loop(), Widget_t::parent, Widget_t::parent_struct, Widget_t::private_struct, Resize_t::rcscale_x, Resize_t::rcscale_y, Widget_t::scale, Resize_t::scale_x, Resize_t::scale_y, Widget_t::state, Func_t::unmap_notify_callback, USE_TRANSPARENCY, Func_t::user_callback, Func_t::value_changed_callback, Func_t::visibiliy_change_callback, Widget_t::width, Widget_t::x, Widget_t::xpaste_callback, and Widget_t::y.

Referenced by add_button(), add_check_box(), add_check_button(), add_combobox(), add_frame(), add_hmeter(), add_hslider(), add_image(), add_image_button(), add_image_knob(), add_image_toggle_button(), add_knob(), add_label(), add_listbox(), add_listview(), add_menu(), add_menubar(), add_midi_keyboard(), add_multi_listview(), add_on_off_button(), add_playhead(), add_popup_spinbox(), add_switch_image_button(), add_tabbox(), add_toggle_button(), add_tuner(), add_valuedisplay(), add_vmeter(), add_vslider(), add_waveview(), cmenu_add_submenu(), create_combobox_viewport(), create_hyperlink(), create_listbox_viewport(), create_listview_viewport(), create_multi_listview_viewport(), create_viewport(), listbox_add_entry(), menu_add_item(), menu_add_numeric_items(), menu_add_submenu(), menu_add_value_entry(), save_file_dialog(), and tabbox_add_tab().

◆ create_window()

Widget_t * create_window ( Xputty app,
Window  win,
int  x,
int  y,
int  width,
int  height 
)

*create_window - create a Window
You need to create as least minimun one Window to get started.
The first created Window is the top_level_widget()
A Window could be created on the DefaultRootWindow() or embeded into a other XWindow

Parameters
*app- pointer to the Xputty *main struct to use
win- pointer to the Parrent Window (may be Root)
x,y,width,height- the position/geometry to create the window
Returns
Widget_t * - pointer to the Widget_t struct
Examples
simple-example.c.

Definition at line 163 of file xwidget.c.

164 {
165
166 Widget_t *w = (Widget_t*)malloc(sizeof(Widget_t));
167 assert(w != NULL);
168 debug_print("assert(w)\n");
169 memset(w, 0, sizeof(Widget_t));
170 w->image = NULL;
171
172 w->flags = IS_WINDOW;
173 w->flags &= ~NO_AUTOREPEAT;
174 w->flags &= ~FAST_REDRAW;
175 w->flags &= ~HIDE_ON_DELETE;
176 w->flags &= ~REUSE_IMAGE;
177 w->flags &= ~NO_PROPAGATE;
178 w->flags &= ~IS_SUBMENU;
179 w->flags &= ~DONT_PROPAGATE;
180 w->app = app;
181 w->parent = &win;
182 w->parent_struct = NULL;
183 w->private_struct = NULL;
184 w->label = NULL;
185 memset(w->input_label, 0, 32 * (sizeof w->input_label[0]));
186 w->state = 0;
187#ifdef __linux__
188 w->double_click = 0;
189#endif
190 w->data = 0;
191 w->x = x;
192 w->y = y;
193 w->width = width;
194 w->height = height;
195 w->scale.init_x = x;
196 w->scale.init_y = y;
197 w->scale.init_width = width;
198 w->scale.init_height = height;
199 w->scale.scale_x = 0.0;
200 w->scale.scale_y = 0.0;
201 w->scale.cscale_x = 1.0;
202 w->scale.cscale_y = 1.0;
203 w->scale.rcscale_x = 1.0;
204 w->scale.rcscale_y = 1.0;
205 w->scale.ascale = 1.0;
206 w->scale.gravity = CENTER;
207 w->adj_x = NULL;
208 w->adj_y = NULL;
209 w->adj = NULL;
210 w->color_scheme = (XColor_t*)malloc(sizeof(XColor_t));
211 memcpy(w->color_scheme, app->color_scheme, sizeof (struct XColor_t));
212 w->childlist = (Childlist_t*)malloc(sizeof(Childlist_t));
213 assert(w->childlist != NULL);
237
238 //XMapWindow(app->dpy, w->widget);
239 //debug_print("size of Func_t = %llu\n", sizeof(w->func)/sizeof(void*));
240
241 os_create_main_window_and_surface(w, app, win, x, y, width, height);
243#ifdef __linux__ // childlist already set up
245#endif
246 return w;
247}
void os_create_main_window_and_surface(Widget_t *w, Xputty *app, Window win, int x, int y, int width, int height)
os_create_main_window_and_surface - create a Widget_t with a acairo surface this function is used mai...
void widget_event_loop(void *w_, void *event, Xputty *main, void *user_data)
widget_event_loop - the internal widget event loop
Definition xwidget.c:506

References _dummy1_callback(), _dummy_callback(), Widget_t::adj, Func_t::adj_callback, Widget_t::adj_x, Widget_t::adj_y, Widget_t::app, Resize_t::ascale, Func_t::button_press_callback, Func_t::button_release_callback, CENTER, Xputty::childlist, Widget_t::childlist, childlist_add_child(), childlist_init(), Xputty::color_scheme, Widget_t::color_scheme, Func_t::configure_callback, configure_event(), Func_t::configure_notify_callback, create_cairo_context_and_buffer(), Resize_t::cscale_x, Resize_t::cscale_y, Widget_t::data, Func_t::dialog_callback, Func_t::dnd_notify_callback, Widget_t::double_click, Func_t::double_click_callback, Func_t::enter_callback, Widget_t::event_callback, Func_t::expose_callback, Widget_t::flags, Widget_t::func, Resize_t::gravity, Widget_t::height, Widget_t::image, Resize_t::init_height, Resize_t::init_width, Resize_t::init_x, Resize_t::init_y, Widget_t::input_label, IS_WINDOW, Func_t::key_press_callback, Func_t::key_release_callback, Widget_t::label, Func_t::leave_callback, Func_t::map_notify_callback, Func_t::mem_free_callback, Func_t::motion_callback, os_adjustment_callback(), os_create_main_window_and_surface(), Widget_t::parent, Widget_t::parent_struct, Widget_t::private_struct, Resize_t::rcscale_x, Resize_t::rcscale_y, Widget_t::scale, Resize_t::scale_x, Resize_t::scale_y, Widget_t::state, Func_t::unmap_notify_callback, Func_t::user_callback, Func_t::value_changed_callback, Func_t::visibiliy_change_callback, widget_event_loop(), Widget_t::width, Widget_t::x, Widget_t::xpaste_callback, and Widget_t::y.

Referenced by add_popup_spinbox(), create_combobox_menu(), create_menu(), create_tooltip(), mk_open_midi_keyboard(), open_directory_dialog(), open_file_dialog(), open_message_dialog(), open_midi_keyboard(), and save_file_dialog().

◆ destroy_widget()

void destroy_widget ( Widget_t w,
Xputty main 
)

destroy_widget - destroy a widget
When a Widget_t receive a destroy_widget() call, it will propagate that to all childs in it's Childlist_t. So all childs get destroyed before the Widget_t itself close.

Parameters
*w- pointer to the Widget_t sending the request
*main- pointer to main struct

Definition at line 86 of file xwidget.c.

86 {
87 int count = childlist_find_child(main->childlist, w);
88 if (count == 0 && main->run == true) {
89 quit(w);
90 } else if(childlist_find_child(main->childlist, w)>=0) {
91 if(w->flags & REUSE_IMAGE) {
92 w->image = NULL;
93 }
94 if(w->flags & HAS_MEM) {
95 w->func.mem_free_callback(w, NULL);
96 }
98 int ch = childlist_has_child(w->childlist);
99 if (ch) {
100 int i = ch;
101 for(;i>0;i--) {
102 destroy_widget(w->childlist->childs[i-1],main);
103
104 }
105 destroy_widget(w,main);
106 }
107 if(w->flags & IS_WIDGET) {
108 Widget_t *p = (Widget_t *) w->parent;
109 childlist_remove_child(p->childlist, w);
110 }
114 cairo_surface_destroy(w->image);
115 cairo_destroy(w->crb);
116 cairo_surface_destroy(w->buffer);
117 cairo_destroy(w->cr);
118 cairo_surface_destroy(w->surface);
119
121 free(w->color_scheme);
122 free(w->childlist);
123 free(w);
124 w = NULL;
125 }
126}
Widget_t ** childs
Definition xchildlist.h:51
cairo_surface_t * surface
Definition xwidget.h:483
cairo_surface_t * buffer
Definition xwidget.h:487
cairo_t * crb
Definition xwidget.h:489
cairo_t * cr
Definition xwidget.h:485
bool run
Definition xputty.h:256
void * delete_adjustment(Adjustment_t *adj)
delete_adjustment - freeing the memory of the Adjustment_t You usually don't need to call this,...
int childlist_find_child(Childlist_t *childlist, Widget_t *child)
childlist_find_child - find a child in a the Childlist_t this could be sued to check if a Widget_t is...
Definition xchildlist.c:69
void childlist_destroy(Childlist_t *childlist)
childlist_destroy - internal use to free the Childlist_t You usually didn't need to call this
Definition xchildlist.c:38
void childlist_remove_child(Childlist_t *childlist, Widget_t *child)
childlist_remove_child - internal use to remove a child from the childlist You usually didn't need ...
Definition xchildlist.c:55
int childlist_has_child(Childlist_t *childlist)
childlist_has_child - check if a Widget_t Childlist_t contain a child
Definition xchildlist.c:89
void os_destroy_window(Widget_t *w)
os_destroy_window - destroy a widget (close and remove from processing)
void quit(Widget_t *w)
quit - exit the main loop
Definition xwidget.c:526
void destroy_widget(Widget_t *w, Xputty *main)
destroy_widget - destroy a widget When a Widget_t receive a destroy_widget() call,...
Definition xwidget.c:86

References Widget_t::adj_x, Widget_t::adj_y, Widget_t::buffer, Xputty::childlist, Widget_t::childlist, childlist_destroy(), childlist_find_child(), childlist_has_child(), childlist_remove_child(), Childlist_t::childs, Widget_t::color_scheme, Widget_t::cr, Widget_t::crb, delete_adjustment(), destroy_widget(), Widget_t::flags, Widget_t::func, HAS_MEM, Widget_t::image, IS_WIDGET, Func_t::mem_free_callback, os_destroy_window(), Widget_t::parent, quit(), REUSE_IMAGE, Xputty::run, and Widget_t::surface.

Referenced by destroy_widget(), main_quit(), menu_remove_item(), os_main_run(), os_run_embedded(), os_widget_event_loop(), tabbox_remove_tab(), and WndProc().

◆ expose_widget()

void expose_widget ( Widget_t w)

◆ get_toplevel_widget()

Widget_t * get_toplevel_widget ( Xputty main)

*get_toplevel_widget - get pointer to the top level Widget_t

Parameters
*main- pointer to the main Xputty struct

Definition at line 441 of file xwidget.c.

441 {
442 return main->childlist->childs[0];
443}

References Xputty::childlist, and Childlist_t::childs.

Referenced by os_quit().

◆ handle_dnd_enter()

void handle_dnd_enter ( Xputty main,
XEvent event 
)

handle_drag_enter - handle drag event enter the Widget_t

Parameters
main- pointer to the Xputty *main struct running
event- the drag event contain the drop data

Definition at line 481 of file xwidget-linux.c.

481 {
482 main->dnd_source_window = DND_SOURCE_WIN(event);
483 main->dnd_version = 0;
484 if (DND_STATUS_ACCEPT(event)) {
485 main->dnd_version = DND_VERSION(event);
486 if (main->dnd_version > 5) return;
487 Atom type = 0;
488 int format;
489 unsigned long count, remaining;
490 unsigned char *data = 0;
491
492 XGetWindowProperty (main->dpy, main->dnd_source_window, main->XdndTypeList,
493 0, 0x8000000L, False, XA_ATOM, &type, &format, &count, &remaining, &data);
494 if (!data || type != XA_ATOM || format != 32) {
495 if (data) {
496 XFree (data);
497 }
498 return;
499 }
500 Atom* types = (Atom*)data;
501 for (unsigned long l = 1; l < count; l++) {
502 if ((types[l] == main->dnd_type_uri) ||
503 (types[l] == main->dnd_type_text) ||
504 (types[l] == main->dnd_type_utf8)) {
505 main->dnd_type = types[l];
506 break;
507 }
508 }
509 if (data) {
510 XFree (data);
511 }
512 } else {
513 for (int i = 2; i < 5; ++i) {
514 if ((event->xclient.data.l[i] == main->dnd_type_uri) ||
515 (event->xclient.data.l[i] == main->dnd_type_text) ||
516 (event->xclient.data.l[i] == main->dnd_type_utf8)) {
517 main->dnd_type = event->xclient.data.l[i];
518 break;
519 }
520 }
521 }
522}
Window dnd_source_window
Definition xputty.h:261
Atom dnd_type_uri
Definition xputty.h:274
int dnd_version
Definition xputty.h:254
Atom dnd_type
Definition xputty.h:276
Atom XdndTypeList
Definition xputty.h:263
Atom dnd_type_utf8
Definition xputty.h:275
Atom dnd_type_text
Definition xputty.h:273
unsigned long int Atom

References Xputty::dnd_source_window, Xputty::dnd_type, Xputty::dnd_type_text, Xputty::dnd_type_uri, Xputty::dnd_type_utf8, Xputty::dnd_version, Xputty::dpy, and Xputty::XdndTypeList.

Referenced by os_widget_event_loop().

◆ handle_drag_data()

void handle_drag_data ( Widget_t w,
XEvent event 
)

handle_drag_data - handle recived drag data

Parameters
w- the Widget_t recive the event
event- the drag event contain the drop data

Definition at line 455 of file xwidget-linux.c.

455 {
456 if (event->xselection.property != w->app->XdndSelection) return;
457
458 Atom type;
459 int format;
460 unsigned long count = 0, remaining;
461 unsigned char* data = 0;
462
463 XGetWindowProperty(w->app->dpy,w->widget, event->xselection.property,
464 0, 65536, True, w->app->dnd_type, &type, &format,
465 &count, &remaining, &data);
466
467 send_dnd_finished_event (w, event);
468
469 if (!data || count == 0) {
470 return;
471 }
472 char* dndfile = (char*)data;
473 strdecode(dndfile, "%20", " ");
474 strremove(dndfile, "file://");
475 w->func.dnd_notify_callback(w, (void*)&dndfile);
476 w->app->dnd_type = None;
477 w->app->dnd_source_window = 0;
478 free(data);
479}
Atom XdndSelection
Definition xputty.h:264
void strdecode(char *target, const char *needle, const char *replacement)
strdecode - replace string in char*
void send_dnd_finished_event(Widget_t *w, XEvent *event)
send_dnd_finished_event - notify the drag sender that the event is handled
void strremove(char *str, const char *sub)

References Widget_t::app, Func_t::dnd_notify_callback, Xputty::dnd_source_window, Xputty::dnd_type, Xputty::dpy, Widget_t::func, send_dnd_finished_event(), strdecode(), strremove(), Widget_t::widget, and Xputty::XdndSelection.

Referenced by os_widget_event_loop().

◆ have_paste()

int have_paste ( Widget_t w)

have_paste - check if clipboard contain a textbuffer

Parameters
w- the Widget_t to send the request

Definition at line 557 of file xwidget-linux.c.

557 {
558 return XGetSelectionOwner(w->app->dpy,w->app->selection);
559}

References Widget_t::app, Xputty::dpy, and Xputty::selection.

◆ hide_tooltip()

void hide_tooltip ( Widget_t wid)

hide_tooltip - check if a Widget_t have a tooltip, and hide it, if a tooltip is mapped.

Parameters
*wid- pointer to the Widget_t receiving the event

Definition at line 430 of file xwidget.c.

430 {
431 int i = 0;
432 for(;i<wid->childlist->elem;i++) {
433 Widget_t *w = wid->childlist->childs[i];
434 if (w->flags & IS_TOOLTIP) {
435 widget_hide(w);
436 break;
437 }
438 }
439}
void widget_hide(Widget_t *w)
widget_hide - unmap/hide a Widget_t
Definition xwidget.c:368

References Widget_t::childlist, Childlist_t::childs, Childlist_t::elem, Widget_t::flags, IS_TOOLTIP, and widget_hide().

Referenced by _draw_combobox_entrys(), _draw_list(), _draw_multi_list(), _list_motion(), _multi_list_motion(), _update_list_view(), _update_view(), os_widget_event_loop(), and WndProc().

◆ key_mapping()

int key_mapping ( Display dpy,
XKeyEvent xkey 
)

_key_mapping - modifier key's mapped to a integer value

Parameters
*dpy- pointer to the Display in use
*xkey- the key to map
Returns
int - value (1-10) or 0 when not mapped

Definition at line 37 of file xwidget.c.

37 {
38 if (xkey->keycode == XKeysymToKeycode(dpy,XK_Tab))
39 return (xkey->state & ShiftMask) ? 1 : 2;
40 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_Up))
41 return 3;
42 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_Right))
43 return 4;
44 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_Down))
45 return 5;
46 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_Left))
47 return 6;
48 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_Home))
49 return 7;
50 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_Insert))
51 return 8;
52 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_End))
53 return 9;
54 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_Return))
55 return 10;
56 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_BackSpace))
57 return 11;
58 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_Delete))
59 return 12;
60 // keypad
61 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_KP_Subtract))
62 return 1;
63 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_KP_Add))
64 return 2;
65 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_KP_Up))
66 return 3;
67 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_KP_Right))
68 return 4;
69 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_KP_Down))
70 return 5;
71 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_KP_Left))
72 return 6;
73 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_KP_Home))
74 return 7;
75 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_KP_Insert))
76 return 8;
77 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_KP_End))
78 return 9;
79 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_KP_Enter))
80 return 10;
81 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_KP_Delete))
82 return 12;
83 else return 0;
84}
unsigned int state
int keycode

References XEvent::keycode, and XEvent::state.

Referenced by _check_keymap(), _combobox_key_pressed(), _list_key_pressed(), and _multi_list_key_pressed().

◆ pop_widget_show_all()

void pop_widget_show_all ( Widget_t w)

pop_widget_show_all - map/show popup widget with all it's childs

Parameters
*w- pointer to the Widget_t to map

Definition at line 400 of file xwidget.c.

400 {
401 if (w->flags & IS_SUBMENU) return;
402 w->func.map_notify_callback(w, NULL);
404 int i=0;
405 for(;i<w->childlist->elem;i++) {
407 }
408}
void os_widget_show(Widget_t *w)
os_widget_show - Show a Widget_t
void pop_widget_show_all(Widget_t *w)
pop_widget_show_all - map/show popup widget with all it's childs
Definition xwidget.c:400

References Widget_t::childlist, Childlist_t::childs, Childlist_t::elem, Widget_t::flags, Widget_t::func, IS_SUBMENU, Func_t::map_notify_callback, os_widget_show(), and pop_widget_show_all().

Referenced by _popup_spinbox(), pop_combobox_menu_show(), pop_menu_show(), and pop_widget_show_all().

◆ quit()

void quit ( Widget_t w)

quit - exit the main loop

Parameters
*w- pointer to the Widget_t sending the request

Definition at line 526 of file xwidget.c.

526 {
527 os_quit(w);
528}
void os_quit(Widget_t *w)
os_quit - quit the main loop and free all used memory

References os_quit().

Referenced by destroy_widget().

◆ quit_widget()

void quit_widget ( Widget_t w)

quit_widget - remove a widget from the processing loop

Parameters
*w- pointer to the Widget_t sending the request

Definition at line 530 of file xwidget.c.

530 {
531 os_quit(w);
532}

References os_quit().

Referenced by os_widget_event_loop(), and WndProc().

◆ receive_paste_from_clipboard()

void receive_paste_from_clipboard ( Widget_t w,
XEvent event 
)

receive_paste_from_clipboard - receive textbuffer from clipboard

Parameters
w- the Widget_t which requested the buffer
event- the event contain the request

Definition at line 566 of file xwidget-linux.c.

566 {
567 if(event->xselection.property) {
568 Atom target;
569 char * data = NULL;
570 int format;
571 unsigned long N, size;
572 XGetWindowProperty(event->xselection.display, event->xselection.requestor,
573 event->xselection.property, 0L,(~0L), 0, AnyPropertyType, &target,
574 &format, &size, &N,(unsigned char**)&data);
575 if(target == w->app->UTF8 || target == XA_STRING) {
576 free(w->app->ctext);
577 w->app->ctext = NULL;
578 w->app->ctext = (unsigned char*)strndup(data, size);
579 XFree(data);
580 }
581 XDeleteProperty(event->xselection.display, event->xselection.requestor, event->xselection.property);
582 w->xpaste_callback(w, (void*)&w->app->ctext);
583 }
584}
Atom UTF8
Definition xputty.h:281

References Widget_t::app, Xputty::ctext, Xputty::UTF8, and Widget_t::xpaste_callback.

Referenced by os_widget_event_loop().

◆ request_paste_from_clipboard()

void request_paste_from_clipboard ( Widget_t w)

request_paste_from_clipboard - request textbuffer from clipboard

Parameters
w- the Widget_t to send the request

Definition at line 561 of file xwidget-linux.c.

561 {
562 Atom XSEL_DATA = XInternAtom(w->app->dpy, "XSEL_DATA", 0);
563 XConvertSelection(w->app->dpy, w->app->selection, w->app->UTF8, XSEL_DATA, w->widget, CurrentTime);
564}

References Widget_t::app, Xputty::dpy, Xputty::selection, Xputty::UTF8, and Widget_t::widget.

◆ resize_childs()

void resize_childs ( Widget_t wid)

resize_childs - intern check if child widgets needs resizing

Parameters
*wid- pointer to the Widget_t receive the event

Definition at line 151 of file xwidget.c.

151 {
153}
void _resize_childs(Widget_t *wid)
_resize_childs - intern check if child widgets needs resizing

References _resize_childs().

◆ send_button_press_event()

void send_button_press_event ( Widget_t w)

send_button_press_event - send ButtonPress event to Widget_t
simulate a BUTTON_PRESS Event

Parameters
*w- pointer to the Widget_t to send the notify

Definition at line 514 of file xwidget.c.

514 {
516}
void os_send_button_press_event(Widget_t *w)
os_send_button_press_event - Send a button press event to a Widget_t see XButtonEvent

References os_send_button_press_event().

Referenced by _check_keymap().

◆ send_button_release_event()

void send_button_release_event ( Widget_t w)

send_button_release_event - send ButtonRelease event to Widget_t
simulate a BUTTON_RELEASE Event

Parameters
*w- pointer to the Widget_t to send the notify

Definition at line 518 of file xwidget.c.

518 {
520}
void os_send_button_release_event(Widget_t *w)
os_send_button_release_event - Send a button release event to a Widget_t see XButtonEvent

References os_send_button_release_event().

Referenced by _check_keymap().

◆ send_configure_event()

void send_configure_event ( Widget_t w,
int  x,
int  y,
int  width,
int  height 
)

send_configure_event - send a ConfigureNotify to Widget_t
used to resize a Widget_t

Parameters
*w- pointer to the Widget_t to send the notify
x,y- the new Widget_t position
width,height- the new Widget_t size

Definition at line 510 of file xwidget.c.

510 {
511 os_send_configure_event(w, x, y, width, height);
512}
void os_send_configure_event(Widget_t *w, int x, int y, int width, int height)
os_send_configure_event - Send a configure event to a Widget_t

References os_send_configure_event().

◆ send_dnd_finished_event()

void send_dnd_finished_event ( Widget_t w,
XEvent event 
)

send_dnd_finished_event - notify the drag sender that the event is handled

Parameters
w- the Widget_t handled the event
event- the drag event contain the drop data

Definition at line 540 of file xwidget-linux.c.

540 {
541 if (w->app->dnd_version < 2) {
542 return;
543 }
544 XEvent xev;
545 memset (&xev, 0, sizeof (XEvent));
546 xev.xany.type = ClientMessage;
547 xev.xany.display = w->app->dpy;
548 xev.xclient.window = w->app->dnd_source_window;
549 xev.xclient.message_type = w->app->XdndFinished;
550 xev.xclient.format = 32;
551 xev.xclient.data.l[0] = event->xany.window;
552 xev.xclient.data.l[1] = 1;
553 xev.xclient.data.l[2] = w->app->XdndActionCopy;
554 XSendEvent (w->app->dpy, w->app->dnd_source_window, False, NoEventMask, &xev);
555}
Window window
Atom XdndActionCopy
Definition xputty.h:270
Atom XdndFinished
Definition xputty.h:271

References Widget_t::app, Xputty::dnd_source_window, Xputty::dnd_version, Xputty::dpy, XEvent::window, Xputty::XdndActionCopy, and Xputty::XdndFinished.

Referenced by handle_drag_data(), and os_widget_event_loop().

◆ send_dnd_status_event()

void send_dnd_status_event ( Widget_t w,
XEvent event 
)

send_dnd_status_event - notify the drag sender that prepared to recive the event

Parameters
w- the Widget_t to recive the event
event- the drag event contain the drop data

Definition at line 524 of file xwidget-linux.c.

524 {
525 XEvent xev;
526 memset (&xev, 0, sizeof (XEvent));
527 xev.xany.type = ClientMessage;
528 xev.xany.display = w->app->dpy;
529 xev.xclient.window = w->app->dnd_source_window;
530 xev.xclient.message_type = w->app->XdndStatus;
531 xev.xclient.format = 32;
532 xev.xclient.data.l[0] = event->xany.window;
533 xev.xclient.data.l[1] = (w->app->dnd_type != None) ? 1 : 0;
534 xev.xclient.data.l[2] = DND_DROP_TIME(event);
535 xev.xclient.data.l[3] = 0;
536 xev.xclient.data.l[4] = w->app->XdndActionCopy;
537 XSendEvent (w->app->dpy, w->app->dnd_source_window, False, NoEventMask, &xev);
538}
Atom XdndStatus
Definition xputty.h:265

References Widget_t::app, Xputty::dnd_source_window, Xputty::dnd_type, Xputty::dpy, XEvent::window, Xputty::XdndActionCopy, and Xputty::XdndStatus.

Referenced by os_widget_event_loop().

◆ send_systray_message()

void send_systray_message ( Widget_t w)

send_systray_message - request a systray icon for Widget_t
currently not working

Parameters
*w- pointer to the Widget_t to send the notify

Definition at line 522 of file xwidget.c.

522 {
524}
void os_send_systray_message(Widget_t *w)
os_send_send_systray_message - Send a systray event to a Widget_t only working on Linux for now

References os_send_systray_message().

◆ send_to_clipboard()

void send_to_clipboard ( Widget_t w,
XEvent event 
)

send_to_clipboard - send textbuffer to clipboard on request

Parameters
w- the Widget_t to send the event
event- the event contain the request

Definition at line 595 of file xwidget-linux.c.

595 {
596 XSelectionRequestEvent * xsr = &event->xselectionrequest;
597 XSelectionEvent xev;
598 memset (&xev, 0, sizeof (XSelectionEvent));
599 int R = 0;
600 xev.type = SelectionNotify;
601 xev.display = xsr->display;
602 xev.requestor = xsr->requestor;
603 xev.selection = xsr->selection;
604 xev.time = xsr->time;
605 xev.target = xsr->target;
606 xev.property = xsr->property;
607 if (xev.target == w->app->targets_atom) {
608 R = XChangeProperty (xev.display, xev.requestor, xev.property, XA_ATOM, 32,
609 PropModeReplace, (unsigned char*)&w->app->UTF8, 1);
610 } else if (xev.target == XA_STRING || xev.target == w->app->text_atom) {
611 R = XChangeProperty(xev.display, xev.requestor, xev.property, XA_STRING, 8,
612 PropModeReplace, w->app->ctext, w->app->csize);
613 } else if (xev.target == w->app->UTF8) {
614 R = XChangeProperty(xev.display, xev.requestor, xev.property, w->app->UTF8, 8,
615 PropModeReplace, w->app->ctext, w->app->csize);
616 } else {
617 xev.property = None;
618 }
619 if ((R & 2) == 0) XSendEvent (w->app->dpy, xev.requestor, 0, 0, (XEvent *)&xev);
620 debug_print("send to clipboard %s\n", w->app->ctext);
621}
Atom text_atom
Definition xputty.h:280
Atom targets_atom
Definition xputty.h:279

References Widget_t::app, Xputty::csize, Xputty::ctext, Xputty::dpy, Xputty::targets_atom, Xputty::text_atom, and Xputty::UTF8.

Referenced by os_widget_event_loop().

◆ show_tooltip()

void show_tooltip ( Widget_t wid)

show_tooltip - check if a Widget_t have a tooltip, and show it, if a tooltip is available.

Parameters
*wid- pointer to the Widget_t receiving the event

Definition at line 419 of file xwidget.c.

419 {
420 int i = 0;
421 for(;i<wid->childlist->elem;i++) {
422 Widget_t *w = wid->childlist->childs[i];
423 if (w->flags & IS_TOOLTIP) {
424 os_show_tooltip(wid, w);
425 break;
426 }
427 }
428}
void os_show_tooltip(Widget_t *wid, Widget_t *w)
os_show_tooltip - Show a tooltip of a Widget_t

References Widget_t::childlist, Childlist_t::childs, Childlist_t::elem, Widget_t::flags, IS_TOOLTIP, and os_show_tooltip().

Referenced by _draw_combobox_entrys(), _draw_list(), _draw_multi_list(), _update_list_view(), _update_view(), os_widget_event_loop(), and WndProc().

◆ strdecode()

void strdecode ( char *  target,
const char *  needle,
const char *  replacement 
)

strdecode - replace string in char*

Parameters
*target- the string to modify
*needle- the string to replace
*replacement- the replacement for the needle

Definition at line 432 of file xwidget-linux.c.

432 {
433 char buffer[1024] = { 0 };
434 char *insert_point = &buffer[0];
435 const char *tmp = target;
436 size_t needle_len = strlen(needle);
437 size_t repl_len = strlen(replacement);
438
439 while (1) {
440 const char *p = strstr(tmp, needle);
441 if (p == NULL) {
442 strcpy(insert_point, tmp);
443 break;
444 }
445 memcpy(insert_point, tmp, p - tmp);
446 insert_point += p - tmp;
447 memcpy(insert_point, replacement, repl_len);
448 insert_point += repl_len;
449 tmp = p + needle_len;
450 }
451 strcpy(target, buffer);
452}

Referenced by handle_drag_data().

◆ submenu_widget_show_all()

void submenu_widget_show_all ( Widget_t w)

submenu_widget_show_all - map/show submenu Widget_t with all childs

Parameters
*w- pointer to the Widget_t to map

Definition at line 410 of file xwidget.c.

410 {
411 w->func.map_notify_callback(w, NULL);
413 int i=0;
414 for(;i<w->childlist->elem;i++) {
416 }
417}
void submenu_widget_show_all(Widget_t *w)
submenu_widget_show_all - map/show submenu Widget_t with all childs
Definition xwidget.c:410

References Widget_t::childlist, Childlist_t::childs, Childlist_t::elem, Widget_t::func, Func_t::map_notify_callback, os_widget_show(), and submenu_widget_show_all().

Referenced by pop_submenu_show(), and submenu_widget_show_all().

◆ transparent_draw()

void transparent_draw ( void *  wid,
void *  user_data 
)

transparent_draw - copy parent surface to child surface
you usaualy didn't need to call this, it's used automaticaly when a Widget_t have set the flag USE_TRANSPARENCY
this is the default setting for Widget_t

Parameters
*wid- pointer to the Widget_t receiving the event
*user_data- void pointer to attached user_data

Definition at line 449 of file xwidget.c.

449 {
450 Widget_t *wid = (Widget_t*)w_;
451 Metrics_t m;
452 os_get_window_metrics(wid, &m);
453 if (!m.visible) return;
454
455 cairo_push_group (wid->cr);
456
457 if (wid->flags & USE_TRANSPARENCY) {
458 Widget_t *parent = (Widget_t*)wid->parent;
459
460 debug_print("Widget_t _transparency \n");
461 cairo_set_source_surface (wid->crb, parent->buffer, -m.x, -m.y);
462 cairo_paint (wid->crb);
463 }
464
465 cairo_push_group (wid->crb);
466 wid->func.expose_callback(wid, user_data);
467 cairo_pop_group_to_source (wid->crb);
468 cairo_paint (wid->crb);
469
470 cairo_set_source_surface (wid->cr, wid->buffer,0,0);
471 cairo_paint (wid->cr);
472
473 cairo_pop_group_to_source (wid->cr);
474 cairo_paint (wid->cr);
475 if ( wid->flags & DONT_PROPAGATE) return;
477}
Metrics_t - struct to receive window size, position & visibility Pass this struct to os_get_window_...
void os_get_window_metrics(Widget_t *w, Metrics_t *metrics)
os_get_window_metrics - Get the Merics_t struct related to a Widget_t
void _propagate_child_expose(Widget_t *wid)
_propagate_child_expose - send expose to any child Widget_t

References _propagate_child_expose(), Widget_t::buffer, Widget_t::cr, Widget_t::crb, DONT_PROPAGATE, Func_t::expose_callback, Widget_t::flags, Widget_t::func, os_get_window_metrics(), Widget_t::parent, USE_TRANSPARENCY, Metrics_t::visible, Metrics_t::x, and Metrics_t::y.

Referenced by _propagate_child_expose(), create_hyperlink(), onPaint(), os_adjustment_callback(), os_transparent_draw(), and os_widget_event_loop().

◆ widget_draw()

void widget_draw ( void *  w_,
void *  user_data 
)

widget_draw - redraw only the widget,not the child widgets

Parameters
*w_- pointer to the Widget_t receiving the event
*user_data- void pointer to attached user_data

Definition at line 479 of file xwidget.c.

479 {
480 Widget_t *wid = (Widget_t*)w_;
481
482 cairo_push_group (wid->cr);
483
484 if (wid->flags & USE_TRANSPARENCY) {
485 Widget_t *parent = (Widget_t*)wid->parent;
486 Metrics_t m;
487 os_get_window_metrics(wid, &m);
488
489 debug_print("Widget_t draw widget \n");
490 cairo_set_source_surface (wid->crb, parent->buffer, -m.x, -m.y);
491 cairo_paint (wid->crb);
492 }
493
494 cairo_push_group (wid->crb);
495 wid->func.expose_callback(wid, user_data);
496 cairo_pop_group_to_source (wid->crb);
497 cairo_paint (wid->crb);
498
499 cairo_set_source_surface (wid->cr, wid->buffer,0,0);
500 cairo_paint (wid->cr);
501
502 cairo_pop_group_to_source (wid->cr);
503 cairo_paint (wid->cr);
504}

References Widget_t::buffer, Widget_t::cr, Widget_t::crb, Func_t::expose_callback, Widget_t::flags, Widget_t::func, os_get_window_metrics(), Widget_t::parent, USE_TRANSPARENCY, Metrics_t::x, and Metrics_t::y.

◆ widget_event_loop()

void widget_event_loop ( void *  w_,
void *  event,
Xputty main,
void *  user_data 
)

widget_event_loop - the internal widget event loop

Parameters
*w_- void pointer to the Widget_t receiving the event
*event- void pointer to the XEvent
*main- void pointer to the Xputty *main struct running the event loop
*user_data- void pointer to attached user_data

Definition at line 506 of file xwidget.c.

506 {
507 os_widget_event_loop(w_, event, main, user_data);
508}

References os_widget_event_loop().

Referenced by create_window().

◆ widget_hide()

void widget_hide ( Widget_t w)

widget_hide - unmap/hide a Widget_t

Parameters
*w- pointer to the Widget_t to unmap

Definition at line 368 of file xwidget.c.

368 {
369 int i=0;
370 for(;i<w->childlist->elem;i++) {
372 }
373 w->func.unmap_notify_callback(w, NULL);
375}
void os_widget_hide(Widget_t *w)
os_widget_hide - Hide a Widget_t

References Widget_t::childlist, Childlist_t::childs, Childlist_t::elem, Widget_t::func, os_widget_hide(), Func_t::unmap_notify_callback, and widget_hide().

Referenced by _check_grab(), _check_menu_state(), _check_submenu(), _draw_tabbox(), _enter_submenu(), _hide_all_tooltips(), _leave_submenu(), hide_tooltip(), os_main_run(), os_run_embedded(), pop_menu_show(), widget_hide(), widget_hide_all(), and WndProc().

◆ widget_hide_all()

void widget_hide_all ( Widget_t w)

widget_hide_all - unmap/hide all Widget_t from app

Parameters
*w- pointer to the Widget_t which send the unmap request

Definition at line 377 of file xwidget.c.

377 {
378 int i=0;
379 for(;i<w->app->childlist->elem;i++) {
381 }
382 w->func.unmap_notify_callback(w, NULL);
384}

References Widget_t::app, Xputty::childlist, Childlist_t::childs, Childlist_t::elem, Widget_t::func, os_widget_hide(), Func_t::unmap_notify_callback, and widget_hide().

◆ widget_reset_scale()

void widget_reset_scale ( Widget_t w)

widget_reset_scale - used to reset scaling mode after a image surface is drawn to the Widget_t surface with widget_set_scale()

Parameters
*w- pointer to the Widget_t sending the request

Definition at line 155 of file xwidget.c.

155 {
156 cairo_scale(w->crb, w->scale.cscale_x,w->scale.cscale_y);
157}

References Widget_t::crb, Resize_t::cscale_x, Resize_t::cscale_y, and Widget_t::scale.

Referenced by _draw_playhead().

◆ widget_set_dnd_aware()

void widget_set_dnd_aware ( Widget_t w)

widget_set_dnd_aware - allow drag and drop for on Widget_t

Parameters
w- the Widget_t to send the event to

Definition at line 409 of file xwidget-linux.c.

409 {
410 Atom dnd_version = 5;
411 XChangeProperty (w->app->dpy, w->widget, w->app->XdndAware, XA_ATOM,
412 32, PropModeReplace, (unsigned char*)&dnd_version, 1);
413}
Atom XdndAware
Definition xputty.h:262

References Widget_t::app, Xputty::dpy, Widget_t::widget, and Xputty::XdndAware.

◆ widget_set_dnd_unaware()

void widget_set_dnd_unaware ( Widget_t w)

widget_set_dnd_unaware - disable drag and drop for on Widget_t

Parameters
w- the Widget_t to send the event to

Definition at line 415 of file xwidget-linux.c.

415 {
416 XDeleteProperty(w->app->dpy, w->widget, w->app->XdndAware);
417}

References Widget_t::app, Xputty::dpy, Widget_t::widget, and Xputty::XdndAware.

◆ widget_set_scale()

void widget_set_scale ( Widget_t w)

widget_set_scale - set scaling mode to scale a image surface to the size of the Widget_t surface

Parameters
*w- pointer to the Widget_t sending the request

Definition at line 159 of file xwidget.c.

159 {
160 cairo_scale(w->crb, w->scale.rcscale_x,w->scale.rcscale_y);
161}

References Widget_t::crb, Resize_t::rcscale_x, Resize_t::rcscale_y, and Widget_t::scale.

Referenced by _draw_playhead().

◆ widget_set_title()

void widget_set_title ( Widget_t w,
const char *  title 
)

widget_set_title - set window title for a Widget_t

Parameters
*w- pointer to the Widget_t to set the title
*title- the title to store

Definition at line 359 of file xwidget.c.

359 {
360 os_set_title(w, title);
361}
void os_set_title(Widget_t *w, const char *title)
os_set_title - Set the title of a Widget_t

References os_set_title().

Referenced by mk_open_midi_keyboard(), open_directory_dialog(), open_file_dialog(), open_message_dialog(), and save_file_dialog().

◆ widget_show()

void widget_show ( Widget_t w)

widget_show - map/show widget

Parameters
*w- pointer to the Widget_t to map

Definition at line 363 of file xwidget.c.

363 {
364 w->func.map_notify_callback(w, NULL);
366}

References Widget_t::func, Func_t::map_notify_callback, and os_widget_show().

◆ widget_show_all()

void widget_show_all ( Widget_t w)

widget_show_all - map/show Widget_t with all childs

Parameters
*w- pointer to the Widget_t to map
Examples
simple-example.c.

Definition at line 386 of file xwidget.c.

386 {
387 if (w->flags & IS_POPUP || w->flags & IS_TOOLTIP ||
388 w->flags & IS_SUBMENU) {
389 return;
390 } else {
391 w->func.map_notify_callback(w, NULL);
393 int i=0;
394 for(;i<w->childlist->elem;i++) {
396 }
397 }
398}
void widget_show_all(Widget_t *w)
widget_show_all - map/show Widget_t with all childs
Definition xwidget.c:386

References Widget_t::childlist, Childlist_t::childs, Childlist_t::elem, Widget_t::flags, Widget_t::func, IS_POPUP, IS_SUBMENU, IS_TOOLTIP, Func_t::map_notify_callback, os_widget_show(), and widget_show_all().

Referenced by _draw_tabbox(), open_directory_dialog(), open_file_dialog(), open_message_dialog(), save_file_dialog(), and widget_show_all().

◆ widget_type_name()

const char * widget_type_name ( Widget_t w)

widget_type_name - textual representation of (Widget_t*)->widget_type

Parameters
w- the Widget_t* to query (NULL is allowed)
Returns
const char* - zero terminated string; must not be free()d

Definition at line 27 of file xwidget.c.

27 {
28 if (!w)
29 return widget_type_names[0]; // "WT_NONE"
30 else if (w->widget_type >= XPUTTY_WIDGET_NAME_COUNT)
31 return widget_type_names[XPUTTY_WIDGET_NAME_COUNT]; // "UNKNOWN"
32 else
33 return widget_type_names[w->widget_type];
34}
WidgetType widget_type
Definition xwidget.h:477

References Widget_t::widget_type.