Changeset e74c01c for editwin.c


Ignore:
Timestamp:
Oct 27, 2006, 1:39:46 PM (14 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
db8b00b
Parents:
1b6b2f3
Message:
I failed to commit this in the last ci
File:
1 edited

Legend:

Unmodified
Added
Removed
  • editwin.c

    r4c46dfd re74c01c  
    3535  e->dotsend=0;
    3636  e->echochar='\0';
     37
     38  /*
     39    // We get initialized multiple times, but we need to hold on to
     40    // the callbacks, so we can't NULL them here.
     41    e->command = NULL;
     42    e->callback = NULL;
     43    e->cbdata = NULL;
     44  */
    3745  if (win) werase(win);
    3846}
     
    7482{
    7583  e->dotsend=1;
     84}
     85
     86void owl_editwin_set_command(owl_editwin *e, char *command) {
     87  if(e->command) owl_free(e->command);
     88  e->command = owl_strdup(command);
     89}
     90
     91char *owl_editwin_get_command(owl_editwin *e) {
     92  if(e->command) return e->command;
     93  return "";
     94}
     95
     96void owl_editwin_set_callback(owl_editwin *e, void (*cb)(owl_editwin*)) {
     97  e->callback = cb;
     98}
     99
     100void (*owl_editwin_get_callback(owl_editwin *e))(owl_editwin*) {
     101  return e->callback;
     102}
     103
     104void owl_editwin_set_cbdata(owl_editwin *e, void *data) {
     105  e->cbdata = data;
     106}
     107
     108void* owl_editwin_get_cbdata(owl_editwin *e) {
     109  return e->cbdata;
     110}
     111
     112void owl_editwin_do_callback(owl_editwin *e) {
     113  void (*cb)(owl_editwin*);
     114  cb=owl_editwin_get_callback(e);
     115  if(!cb) {
     116    owl_function_error("Internal error: No editwin callback!");
     117  } else {
     118    // owl_function_error("text: |%s|", owl_editwin_get_text(e));
     119    cb(e);
     120  }
    76121}
    77122
Note: See TracChangeset for help on using the changeset viewer.