GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
AG_SOCKET(3) FreeBSD Library Functions Manual AG_SOCKET(3)

AG_Socketagar socket widget

#include <agar/core.h>
#include <agar/gui.h>

The AG_Socket widget is a place holder for one or more drag-and-droppable AG_Icon(3) widgets (or subclasses of it). AG_Socket also provides a boolean ‘state’ binding and a numerical ‘count’ binding.

AG_Object(3) -> AG_Widget(3) -> AG_Socket.

AG_Socket *
(AG_Widget *parent, Uint flags);


AG_Socket *
(AG_Widget *parent, Uint flags, AG_Surface *s);


AG_Socket *
(AG_Widget *parent, Uint flags, const char *file);


void
(AG_Socket *socket, int (*fn)(AG_Socket *, AG_Icon *));


void
(AG_Socket *socket, void (*fn)(AG_Socket *, AG_Icon *));


void
(AG_Socket *socket, AG_EventFn fn, const char *fmt, ...);


void
(AG_Socket *socket, int left, int right, int top, int bottom);


void
(AG_Socket *socket, Uint width, Uint height);


void
(AG_Socket *socket, Uint radius);


void
(AG_Socket *socket, const AG_Surface *s);


void
(AG_Socket *socket, AG_Surface *s);

The () function allocates, initializes, and attaches a new AG_Socket widget. The AG_SocketFromSurface() and AG_SocketFromBMP() variants also set a background image for the socket, typically used to show the type of icons that can be drag-and-dropped onto the socket. Acceptable flags include:

AG_SOCKET_STICKY_STATE
Mouse click should toggle the boolean state.
AG_SOCKET_HFILL
Expand horizontally in parent container.
AG_SOCKET_VFILL
Expand vertically in parent container.
AG_SOCKET_EXPAND
Shorthand for AG_SOCKET_HFILL | .

The () function configures a callback routine () that will be invoked whenever the user tries to drop an icon onto the socket. A pointer to the socket and the icon being dropped will be passed to that function. Typically, this routine will use () to assign the icon to the socket. If fn() returns 1, the drag-and-drop item will be destroyed.

The () function registers a callback routine that will be invoked before an icon is removed from a socket.

The () registers a routine that will be invoked in rendering context to draw items on top of the socket (and any contained icons).

The () function sets the padding around the socket's icon area in pixels.

() configures the socket to use a rectangular shape of the given dimensions in pixels.

() arranges for the socket to use a circular shape of the given radius in pixels.

() uses (a duplicate of) the given surface as background image. The AG_SocketBgPixmapNODUP() variant uses the surface without copy (potentially unsafe).

The AG_Socket widget generates the following events:

(int state)
Cursor has moved inside or outside socket area.
(int state)
User has clicked on the socket area.

The AG_Socket widget provides the following bindings.

BOOL *state
A generic boolean state associated with the socket.
INT *count
A generic "count" associated with the socket. Typically used when the socket contains a stack of items.

See tests/sockets.c in the Agar source distribution.

For the AG_Socket object:

AG_Icon *icon
Icon in socket or NULL (read-only).

AG_Button(3), AG_Intro(3), AG_Pixmap(3), AG_Surface(3), AG_Widget(3), AG_Window(3)

The AG_Socket widget first appeared in Agar 1.0.

December 21, 2022 Agar 1.7

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.