feisty meow concerns codebase  2.140
process_anchor.h
Go to the documentation of this file.
1 #ifndef PROCESS_ANCHOR_CLASS
2 #define PROCESS_ANCHOR_CLASS
3 
4 /*
5 *
6 * Name : process_anchor
7 * Author : Chris Koeritz
8 *
9 ****
10 * Copyright (c) 2000-$now By Author. This program is free software; you can
11 * redistribute it and/or modify it under the terms of the GNU General Public
12 * License as published by the Free Software Foundation; either version 2 of
13 * the License or (at your option) any later version. This is online at:
14 * http://www.fsf.org/copyleft/gpl.html
15 * Please send any updates to: fred@gruntose.com
16 */
17 
19 #include <basis/astring.h>
20 
21 #ifdef __LINUX__
22  #include "shutdown_alerter.h"
23 #endif
24 
26 
34 #ifdef __LINUX__
35 : public shutdown_alerter
36 #endif
37 {
38 public:
41 
42  virtual ~process_anchor();
43 
44  DEFINE_CLASS_NAME("process_anchor");
45 
46  static bool close_this_program();
48 
54  static bool close_app_anchor(const basis::astring &app_name);
56 
61  bool defunct() const;
63 
65  void set_defunct();
67 
68  bool setup(application_instance handle, const basis::astring &application_name,
69  int timing_cycle = 0);
71 
81  void register_anchor(window_handle anchor);
83 
88  static bool launch(process_anchor &anchor, application_instance handle,
89  const basis::astring &app, int cycle = 0);
91 
99  virtual void handle_startup();
101 
105  virtual void handle_timer();
107 
108  virtual void handle_shutdown();
110 
111  static basis::astring make_well_known_title(const basis::astring &application_name);
113 
118  static basis::astring make_well_known_class(const basis::astring &application_name);
120 
121 private:
122  application_instance _instance;
123  basis::astring *_anchor_title;
124  basis::astring *_anchor_class;
125  ATOM _class_reg;
126  window_handle _wind_handle;
127  int _cycle;
128  bool _defunct;
129 
130  ATOM register_class();
132 
133 #ifdef __WIN32__
134  static LRESULT CALLBACK WndProc(HWND wind, UINT msg, WPARAM wp, LPARAM lp);
136 #endif
137 
138  // not appropriate.
140  process_anchor &operator =(const process_anchor &);
141 };
142 
143 #endif // outer guard.
144 
Provides a dynamically resizable ASCII character string.
Definition: astring.h:35
Implements a graceful shutdown procedure for an application.
void set_defunct()
used by the derived class to mark that this object is about to exit.
static bool close_this_program()
causes this particular program to shut down.
bool setup(application_instance handle, const basis::astring &application_name, int timing_cycle=0)
constructs a process_anchor for the "application_name" specified.
DEFINE_CLASS_NAME("process_anchor")
virtual void handle_startup()
derived classes can override this to catch the application startup.
virtual void handle_timer()
invoked periodically if the anchor was setup() with a timer "cycle".
static basis::astring make_well_known_class(const basis::astring &application_name)
same as above but for the anchor's class name.
void register_anchor(window_handle anchor)
this supports the anchor being created elsewhere.
static bool launch(process_anchor &anchor, application_instance handle, const basis::astring &app, int cycle=0)
establishes a process_anchor for the program named "app".
process_anchor()
constructor does very little; setup() begins operation.
static bool close_app_anchor(const basis::astring &app_name)
closes the anchor object associated with "app_name".
bool defunct() const
returns true if the object has been marked as defunct.
static basis::astring make_well_known_title(const basis::astring &application_name)
returns the string form of the well-known window title for the process_anchor.
virtual void handle_shutdown()
invoked just prior to the shutdown of this anchor.
virtual ~process_anchor()
A platform-independent way to alert a program that it should shut down immediately.
Aids in achievement of platform independence.
void * ATOM
void * application_instance
void * window_handle