Example #1
0
Menu.prototype._resolveMenu = function(clear, pushing) {
  var sections = this._getSections(this);
  if (this === WindowStack.top()) {
    simply.impl.menu(this.state, clear, pushing);
    return true;
  }
};
Example #2
0
Wakeup.cancel = function(id) {
  if (id === 'all') {
    this.state.wakeups = {};
  } else {
    delete this.state.wakeups[id];
  }
  simply.impl.wakeupCancel(id);
};
Example #3
0
StageElement.prototype._prop = function(elementDef) {
  if (!this.state.position) {
    this.state.position = new Vector2();
  }
  if (!this.state.size) {
    this.state.size = new Vector2();
  }
  if (this.parent === WindowStack.top()) {
    simply.impl.stageElement(this._id(), this._type(), elementDef);
  }
};
Example #4
0
 imagelib.load(image, function() {
   simply.impl.image(image.id, image.gbitmap);
   if (callback) {
     var e = {
       type: 'image',
       image: image.id,
       url: image.url,
     };
     callback(e);
   }
 });
Example #5
0
Menu.prototype.selection = function(callback_or_sectionIndex, itemIndex) {
  if (typeof callback_or_sectionIndex === 'function') {
    this._selections.push(callback);
    simply.impl.menuSelection();
  } else {
    this._selection = {
      sectionIndex: callback_or_sectionIndex,
      itemIndex: itemIndex
    };
    this._select();
  }
};
Example #6
0
Wakeup.schedule = function(opt, callback) {
  if (typeof opt !== 'object' || opt instanceof Date) {
    opt = { time: opt };
  }
  var cookie = opt.cookie || 0;
  this._setRequests.push({
    params: opt,
    data: opt.data,
    callback: callback,
  });
  simply.impl.wakeupSet(opt.time, cookie, opt.notifyIfMissed);
};
Example #7
0
Accel.config = function(opt, auto) {
  if (arguments.length === 0) {
    return {
      rate: state.rate,
      samples: state.samples,
      subscribe: state.subscribe,
    };
  } else if (typeof opt === 'boolean') {
    opt = { subscribe: opt };
  }
  for (var k in opt) {
    if (k === 'subscribe') {
      state.subscribeMode = opt[k] && !auto ? 'manual' : 'auto';
    }
    state[k] = opt[k];
  }
  return simply.impl.accelConfig(Accel.config());
};
Example #8
0
Window.prototype._buttonConfig = function(buttonConf, auto) {
  if (buttonConf === undefined) {
    var config = {};
    for (var i = 0, ii = buttons.length; i < ii; ++i) {
      var name = buttons[i];
      config[name] = this._button.config[name];
    }
    return config;
  }
  for (var k in buttonConf) {
    if (buttons.indexOf(k) !== -1) {
      if (k === 'back') {
        this._button.configMode = buttonConf.back && !auto ? 'manual' : 'auto';
      }
      this._button.config[k] = buttonConf[k];
    }
  }
  if (simply.impl.windowButtonConfig) {
    return simply.impl.windowButtonConfig(this._button.config);
  }
};
Example #9
0
Window.prototype._hide = function(broadcast) {
  if (broadcast === false) { return; }
  simply.impl.windowHide(this._id());
};
Example #10
0
Window.prototype._action = function(actionDef) {
  if (this === WindowStack.top()) {
    simply.impl.windowActionBar(actionDef);
  }
};
Example #11
0
Menu.prototype.selection = function(callback) {
  this._selections.push(callback);
  simply.impl.menuSelection();
};
Example #12
0
Menu.prototype._show = function() {
  this._resolveMenu();
  Window.prototype._show.apply(this, arguments);
  var select = this._selection;
  simply.impl.menuSelection(select.sectionIndex, select.itemIndex);
};
Example #13
0
Window.prototype._status = function(statusDef) {
  if (this === WindowStack.top()) {
    simply.impl.windowStatusBar(statusDef);
  }
};
Example #14
0
Light.auto = function() {
  simply.impl.light('auto');
};
Example #15
0
 this.launch(function() {
   simply.impl.wakeupSet(opt.time, cookie, opt.notifyIfMissed);
 });
Example #16
0
Light.on = function() {
  simply.impl.light('on');
};
Example #17
0
StageElement.prototype._prop = function(elementDef) {
  if (this.parent === WindowStack.top()) {
    simply.impl.stageElement(this._id(), this._type(), this.state);
  }
};
Example #18
0
Vibe.vibrate = function(type) {
  simply.impl.vibe(type);
};
Example #19
0
StageElement.prototype._animate = function(animateDef, duration) {
  if (this.parent === WindowStack.top()) {
    simply.impl.stageAnimate(this._id(), this.state,
        animateDef, duration || 400, animateDef.easing || 'easeInOut');
  }
};
Example #20
0
Menu.prototype._select = function() {
  if (this === WindowStack.top()) {
    var select = this._selection;
    simply.impl.menuSelection(select.sectionIndex, select.itemIndex);
  }
};
Example #21
0
Light.trigger = function() {
  simply.impl.light('trigger');
};