button.cpp

Go to the documentation of this file.
00001 #ifndef BUTTON_IMPLEMENTATION_FILE
00002 #define BUTTON_IMPLEMENTATION_FILE
00003 
00004 /*****************************************************************************\
00005 *                                                                             *
00006 *  Name   : button                                                            *
00007 *  Author : Chris Koeritz                                                     *
00008 *                                                                             *
00009 *******************************************************************************
00010 * Copyright (c) 1991-$now By Author.  This program is free software; you can  *
00011 * redistribute it and/or modify it under the terms of the GNU General Public  *
00012 * License as published by the Free Software Foundation; either version 2 of   *
00013 * the License or (at your option) any later version.  This is online at:      *
00014 *     http://www.fsf.org/copyleft/gpl.html                                    *
00015 * Please send any updates to: fred@gruntose.com                               *
00016 \*****************************************************************************/
00017 
00018 #include "button.h"
00019 
00020 #include <basis/function.h>
00021 #include <wp_passive/argument_list.h>
00022 #include <wp_passive/color.h>
00023 #include <wp_passive/system_string.h>
00024 #include <wp_passive/wp_implementation.h>
00025 
00026 #ifdef __XWINDOWS__
00027 #include <Xm/PushB.h>
00028 #elif defined(MS_WINDOWS)
00029 #elif defined(OS_2)
00030 #endif
00031 
00032 void button_callback(window_handle , button *me, XmAnyCallbackStruct *)
00033 { me->button_event(); }
00034 
00035 button::button(manager &root, const c_point &origin, const char *message,
00036    const color &foreground, const color &background)
00037 : worker(root, c_rectangle(origin, origin),
00038       create_button_handle(root, istring(message), origin),
00039       foreground, background)
00040 {
00041 #ifdef __XWINDOWS__
00042   XtAddCallback
00043     (self(), XmNactivateCallback, XtCallbackProc(button_callback),
00044      XtPointer(this));
00045 #elif defined(OS_2)
00046 #elif defined(MS_WINDOWS)
00047 #endif
00048 }
00049 
00050 button::~button()
00051 {
00052 #ifdef __XWINDOWS__
00053   XtRemoveCallback(self(), XmNactivateCallback,
00054       XtCallbackProc(button_callback), XtPointer(this));
00055 #elif defined(OS_2)
00056 #elif defined(MS_WINDOWS)
00057 #endif
00058 }
00059 
00060 void button::button_event()
00061 {
00062   FUNCDEF("button_event");
00063   LOG("button blank event");
00064 }
00065 
00066 window_handle button::create_button_handle(manager &root,
00067      const istring &message, const c_point &origin)
00068 {
00069 #ifdef __XWINDOWS__
00070   system_string xmess(message);
00071   argument_list wargs;
00072   wargs.add(XmNlabelString, window_string(xmess));
00073   add_origin(wargs, root.universe_to_device(origin));
00074   return XtCreateManagedWidget
00075     ("button", xmPushButtonWidgetClass, root.self(),
00076      wargs.generate(), wargs.number());
00077 #elif defined(OS_2)
00078 #elif defined(MS_WINDOWS)
00079 #endif
00080 }
00081 
00082 
00083 #endif //BUTTON_IMPLEMENTATION_FILE
00084 

Generated on Fri Nov 28 04:29:04 2008 for HOOPLE Libraries by  doxygen 1.5.1