Atrinik Client 2.5
Functions | Variables
toolkit/popup.c File Reference
#include <global.h>

Go to the source code of this file.

Functions

static void popup_create_overlay (popup_struct *popup)
static void popup_free (popup_struct *popup)
popup_structpopup_create (int bitmap_id)
void popup_destroy_visible ()
int popup_overlay_need_update (popup_struct *popup)
void popup_draw ()
int popup_handle_event (SDL_Event *event)
popup_structpopup_get_visible ()

Variables

static popup_structpopup_visible = NULL

Detailed Description

Popup API.

Popup is basically a specified bitmap that appears in the middle of the screen, graying out the background and disabling mouse clicks and keyboard actions on the background.

Graying out the background is managed by using an overlay image, which is an SDL surface created when the popup is created. The pixels from ScreenSurface are copied to this surface and grayed out, and the surface is then copied over the ScreenSurface before doing any actual popup drawing. When the screen size changes, the overlay is re-created.

Definition in file popup.c.


Function Documentation

popup_struct* popup_create ( int  bitmap_id)

Create a new popup.

Parameters:
bitmap_idBitmap ID to use for the popup's background.
Returns:
The created popup.

Definition at line 96 of file popup.c.

static void popup_create_overlay ( popup_struct popup) [static]

Create an overlay to be used by popup.

Parameters:
popupThe popup.

Definition at line 49 of file popup.c.

void popup_destroy_visible ( )

Destroys the currently visible popup, freeing it.

If there is no visible popup, nothing is done.

Definition at line 115 of file popup.c.

void popup_draw ( )

Draw popup, if there is a visible one.

Definition at line 140 of file popup.c.

static void popup_free ( popup_struct popup) [static]

Free popup structure and the popup itself.

Parameters:
popupPopup to free.

Definition at line 79 of file popup.c.

popup_struct* popup_get_visible ( )

Get the currently visible popup.

Returns:
The visible popup, or NULL if there isn't any.

Definition at line 243 of file popup.c.

int popup_handle_event ( SDL_Event *  event)

Handle mouse and keyboard events when a popup is active.

Parameters:
eventEvent.
Returns:
1 to disable any other mouse/keyboard actions, 0 otherwise.

Definition at line 208 of file popup.c.

int popup_overlay_need_update ( popup_struct popup)

See if popup needs an overlay update due to screen resize.

Parameters:
popupPopup.
Returns:
Whether the overlay needs to be updated or not.

Definition at line 133 of file popup.c.


Variable Documentation

popup_struct* popup_visible = NULL [static]

The currently visible popup. NULL if there is no visible popup.

Definition at line 44 of file popup.c.