BB2 C port
API reference: Blitz libraries in C and the shared code
Loading...
Searching...
No Matches
popupwinlib.c File Reference
#include "blitzlib.h"
#include "blitzexec.h"
#include <graphics/rastport.h>
#include <graphics/text.h>
#include <intuition/intuition.h>
#include <intuition/screens.h>
#include <proto/graphics.h>
#include <proto/intuition.h>

Data Structures

struct  pitem
struct  popup

Macros

#define __NOLIBBASE__
#define GRAPHICS_BASE_NAME   gfxbase
#define INTUITION_BASE_NAME   intuibase
#define STRUCT_SIZEOF   64

Functions

void _popupinit (void)
void _dopopup (void)
void popupwinlib_libinit (void)
void popupwinlib_libfinit (void)
static ULONG strlen0 (const UBYTE *s)
static void windowinit (void)
static void flushwinevents (void)
static void windowfinit (void)
static struct Window * openwindow13 (struct Screen *scr, ULONG x, ULONG y, ULONG w, ULONG h, ULONG flags)
static struct Window * openwindow (struct Screen *scr, ULONG x, ULONG y, ULONG w, ULONG h, ULONG flags, ULONG idcmp)
static ULONG waitwinevent (void)
static void closewin (struct Window *win)
static void bevelbox (struct RastPort *rp, WORD x1, WORD y1, WORD x2, WORD y2)
static void bevelwindow (struct Window *win)
static void drawtextitem (struct popup *p, const struct pitem *item, struct RastPort *rp, WORD x, WORD y)
static void drawitems (struct popup *p, struct Window *win)
static void drawactiveitem (struct popup *p, ULONG pen)
static struct popup * findmousewindow (struct popup *p)
static struct pitem * findmouseitem (struct popup *p, UWORD *ypos)
static void clearactive (struct popup *p)
static void mousemove (struct popup *p)
static struct popup * allocstruct (struct pitem *items, struct popup *parent)
static UWORD calcwinsize (struct popup *p, UWORD *h)
static struct Window * newpopupwin (WORD x, WORD y, UWORD w, UWORD h)
static ULONG dopop (struct pitem *items, struct popup *parent, UWORD x, UWORD y)
static void inittemprast (void)
static void libinit_c (void)
 init: opens intuition.library and graphics.library (any version; intuition's decides how the windows open) and builds the message port (fixed #1140: by hand, exec V33).
static void libfinit_c (void)
 finit: replies what is still in the port, deletes it and closes the libraries.
static void popupinit_c (void)
 PopUpInit: the message port for the menu windows, if there is none (init has made it; PopUpInit makes it after a failed port: no memory or no free signal).
static ULONG dopopup_c (struct Screen **scr, struct pitem *items)
 PopUpWindow Screen#,*items: shows the menu items at 0,0 of the screen, waits until a mouse button is pressed and returns the item chosen; a statement and a function.

Variables

static struct Library * intuibase
static struct Library * gfxbase
static struct MsgPort * msgport
static struct Screen * myscreen
static struct RastPort myrast
static struct TextFont * myfont
static UWORD fontheight
static UWORD baseline
static UBYTE hassubs [2]
static ULONG e_msg [8]
struct { 
   struct TagItem left top width height title screen flags detailpen   blockpen 
   struct TagItem minwidth minheight maxwidth maxheight newlookmenus idcmp   gadgets 
   struct TagItem extra   end 
} wwtags

Macro Definition Documentation

◆ __NOLIBBASE__

#define __NOLIBBASE__

◆ GRAPHICS_BASE_NAME

#define GRAPHICS_BASE_NAME   gfxbase

◆ INTUITION_BASE_NAME

#define INTUITION_BASE_NAME   intuibase

◆ STRUCT_SIZEOF

#define STRUCT_SIZEOF   64

Function Documentation

◆ _dopopup()

void _dopopup ( void )

◆ _popupinit()

void _popupinit ( void )

◆ allocstruct()

struct popup * allocstruct ( struct pitem * items,
struct popup * parent )
static

◆ bevelbox()

void bevelbox ( struct RastPort * rp,
WORD x1,
WORD y1,
WORD x2,
WORD y2 )
static

◆ bevelwindow()

void bevelwindow ( struct Window * win)
static

◆ calcwinsize()

UWORD calcwinsize ( struct popup * p,
UWORD * h )
static

◆ clearactive()

void clearactive ( struct popup * p)
static

◆ closewin()

void closewin ( struct Window * win)
static

◆ dopop()

ULONG dopop ( struct pitem * items,
struct popup * parent,
UWORD x,
UWORD y )
static

◆ dopopup_c()

ULONG dopopup_c ( struct Screen ** scr,
struct pitem * items )
static

PopUpWindow Screen#,*items: shows the menu items at 0,0 of the screen, waits until a mouse button is pressed and returns the item chosen; a statement and a function.

Each level is a borderless window with the screen's font; moving over an item highlights it, an item with a sub menu opens it to the right. Fixed (#471): the result is the item DoPop returns; the original returned selecteditem, which is only cleared (always 0), and was a statement only. Fixed (#467): a level without memory for its structure closes all levels. Fixed (#469): closing a level replies only the messages of its window, those for the other levels stay queued.

Parameters
scra0: the screen object (screenslib; first long = the Screen)
itemsd1: the first item of the menu
Returns
d0: the address of the item highlighted when the mouse button was pressed, 0 for none (no item highlighted, a level without memory or without its window)

◆ drawactiveitem()

void drawactiveitem ( struct popup * p,
ULONG pen )
static

◆ drawitems()

void drawitems ( struct popup * p,
struct Window * win )
static

◆ drawtextitem()

void drawtextitem ( struct popup * p,
const struct pitem * item,
struct RastPort * rp,
WORD x,
WORD y )
static

◆ findmouseitem()

struct pitem * findmouseitem ( struct popup * p,
UWORD * ypos )
static

◆ findmousewindow()

struct popup * findmousewindow ( struct popup * p)
static

◆ flushwinevents()

void flushwinevents ( void )
static

◆ inittemprast()

void inittemprast ( void )
static

◆ libfinit_c()

void libfinit_c ( void )
static

finit: replies what is still in the port, deletes it and closes the libraries.

◆ libinit_c()

void libinit_c ( void )
static

init: opens intuition.library and graphics.library (any version; intuition's decides how the windows open) and builds the message port (fixed #1140: by hand, exec V33).

◆ mousemove()

void mousemove ( struct popup * p)
static

◆ newpopupwin()

struct Window * newpopupwin ( WORD x,
WORD y,
UWORD w,
UWORD h )
static

◆ openwindow()

struct Window * openwindow ( struct Screen * scr,
ULONG x,
ULONG y,
ULONG w,
ULONG h,
ULONG flags,
ULONG idcmp )
static

◆ openwindow13()

struct Window * openwindow13 ( struct Screen * scr,
ULONG x,
ULONG y,
ULONG w,
ULONG h,
ULONG flags )
static

◆ popupinit_c()

void popupinit_c ( void )
static

PopUpInit: the message port for the menu windows, if there is none (init has made it; PopUpInit makes it after a failed port: no memory or no free signal).

Fixed (#470): the original created a new port each time and left the old one with its signal bit. (The word argument is not used.)

◆ popupwinlib_libfinit()

void popupwinlib_libfinit ( void )

◆ popupwinlib_libinit()

void popupwinlib_libinit ( void )

◆ strlen0()

ULONG strlen0 ( const UBYTE * s)
static

◆ waitwinevent()

ULONG waitwinevent ( void )
static

◆ windowfinit()

void windowfinit ( void )
static

◆ windowinit()

void windowinit ( void )
static

Variable Documentation

◆ baseline

UWORD baseline
static

◆ blockpen

struct TagItem left top width height title screen flags detailpen blockpen

◆ e_msg

ULONG e_msg[8]
static

◆ end

struct TagItem extra end

◆ fontheight

UWORD fontheight
static

◆ gadgets

struct TagItem minwidth minheight maxwidth maxheight newlookmenus idcmp gadgets

◆ gfxbase

struct Library * gfxbase
static

◆ hassubs

UBYTE hassubs[2]
static

◆ intuibase

struct Library* intuibase
static

◆ msgport

struct MsgPort* msgport
static

◆ myfont

struct TextFont* myfont
static

◆ myrast

struct RastPort myrast
static

◆ myscreen

struct Screen* myscreen
static

◆ [struct]

struct { ... } wwtags
Initial value:
= {
{ WA_Left, 0 }, { WA_Top, 0 }, { WA_Width, 0 }, { WA_Height, 0 }, { WA_Title, 0 },
{ WA_CustomScreen, 0 }, { WA_Flags, 0 }, { WA_DetailPen, (ULONG)-1 },
{ WA_BlockPen, (ULONG)-1 }, { WA_MinWidth, 32 }, { WA_MinHeight, 11 },
{ WA_MaxWidth, 640 }, { WA_MaxHeight, 512 }, { WA_NewLookMenus, (ULONG)-1 },
{ WA_IDCMP, 0 }, { WA_Gadgets, 0 }, { 2, 0 }, { 0, 0 } }