00001 #ifndef BUTTON_IMPLEMENTATION_FILE
00002 #define BUTTON_IMPLEMENTATION_FILE
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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