Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* exported function documented in fbtk.h */
- fbtk_widget_t *
- fbtk_create_writable_text(fbtk_widget_t *parent,
- int x,
- int y,
- int width,
- int height,
- colour bg,
- colour fg,
- bool outline,
- fbtk_enter_t enter,
- void *pw)
- {
- fbtk_widget_t *neww;
- neww = fbtk_widget_new(parent, FB_WIDGET_TYPE_TEXT, x, y, width, height);
- neww->fg = fg;
- neww->bg = bg;
- neww->mapped = true;
- neww->u.text.outline = outline;
- neww->u.text.enter = enter;
- neww->u.text.pw = pw;
- fbtk_set_handler(neww, FBTK_CBT_REDRAW, fb_redraw_text, NULL);
- fbtk_set_handler(neww, FBTK_CBT_INPUT, text_input, neww);
- return neww;
- }
- #include <proto/intuition.h>
- #include <proto/gadtools.h>
- #include <proto/exec.h>
- #include <proto/dos.h>
- #include <intuition/intuition.h>
- #include <libraries/gadtools.h>
- /* exported function documented in fbtk.h */
- fbtk_widget_t *
- fbtk_create_writable_text_ami(fbtk_widget_t *parent,
- int x,
- int y,
- int width,
- int height,
- colour bg,
- colour fg,
- bool outline,
- fbtk_enter_t enter,
- void *pw)
- {
- APTR visual;
- /* Type of gadgets to display */
- ULONG Gadgetkinds[1] = {STRING_KIND};
- struct TextAttr topaz8 = {
- (STRPTR)"topaz.font", 8, 0, 1
- };
- /* Data for gadget structures */
- struct NewGadget Gadgetdata[1] = {
- x, y + 60, width, height, (UBYTE *)"Url", &topaz8, 1, PLACETEXT_LEFT, NULL, NULL,
- };
- /* Extra information for gadgets using Tags */
- ULONG GadgetTags[] = {
- (GTST_MaxChars), 256, (TAG_DONE),
- (GTNM_Border), TRUE, (TAG_DONE),
- (TAG_DONE)
- };
- struct Screen *pubScreen;
- struct Window *myWindow;
- struct Gadget *myGadgets[1], *glist=NULL, *gad1;
- int closewin = FALSE, i;
- struct IntuiMessage *msg;
- ULONG msgClass;
- /* Lock screen and get visual info for gadtools */
- if (pubScreen = LockPubScreen(NULL)) {
- if (!(visual = GetVisualInfo(pubScreen, TAG_DONE))) {
- printf("Failed to get visual info.\n");
- Exit(5);
- }
- }
- else {
- printf("Failed to lock screen.\n");
- Exit(5);
- }
- /* Open window and specify gadget list */
- myWindow = OpenWindowTags(NULL,
- WA_Left, 10, WA_Top, 50,
- WA_Width, option_window_width, WA_Height, option_window_height,
- WA_IDCMP, IDCMP_CLOSEWINDOW | IDCMP_GADGETUP,
- WA_Flags, WFLG_SIZEGADGET | WFLG_DRAGBAR | WFLG_DEPTHGADGET | WFLG_CLOSEGADGET | WFLG_ACTIVATE | WFLG_SMART_REFRESH,
- WA_Gadgets, glist,
- WA_Title, "",
- WA_PubScreenName, "Workbench",
- TAG_DONE);
- GT_RefreshWindow(myWindow, NULL); /* Update window */
- while (closewin == FALSE) {
- Wait(1L << myWindow->UserPort->mp_SigBit);
- msg = GT_GetIMsg(myWindow->UserPort);
- msgClass = msg->Class;
- GT_ReplyIMsg(msg);
- if (msgClass == IDCMP_CLOSEWINDOW) {
- closewin = TRUE;
- }
- }
- if (myWindow) CloseWindow(myWindow);
- /* Free gadgets */
- if (glist) FreeGadgets(glist);
- if (visual) FreeVisualInfo(visual);
- if (pubScreen) UnlockPubScreen(NULL, pubScreen);
- return(0);
- //return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement