示例#1
0
文件: test_entry.cpp 项目: gzorin/e17
void test_entry_scolled (void *data, Evas_Object *obj, void *event_info)
{
  Button *bt = NULL;
  Entry *en = NULL;
  Scroller *sc = NULL;

  Window *win = Window::factory ("entry-scrolled", ELM_WIN_BASIC);
  win->setTitle ("Entry Scrolled");
  win->setAutoDel (true);

  Background *bg = Background::factory (*win);
  win->addObjectResize (*bg);
  bg->setWeightHintSize (EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  bg->show ();

  Box *bx = Box::factory (*win);
  bx->setWeightHintSize (EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  win->addObjectResize (*bx);
  bx->show ();

  sc = Scroller::factory (*win);
  sc->limitMinContent (false, true);
  sc->setPolicy (ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
  sc->setWeightHintSize (EVAS_HINT_EXPAND, 0.0);
  sc->setAlignHintSize (EVAS_HINT_FILL, EVAS_HINT_FILL);
  bx->packEnd (*sc);

  en = Entry::factory (*win);
  en->setSingleLine (true);
  en->setText ("This is a single line");
  en->setWeightHintSize (EVAS_HINT_EXPAND, 0.0);
  en->setAlignHintSize (EVAS_HINT_FILL, 0.5);
  en->selectAll ();
  sc->setContent (*en);
  en->show ();

  sc->show ();

  sc = Scroller::factory (*win);
  sc->limitMinContent (false, true);
  sc->setPolicy (ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
  sc->setWeightHintSize (EVAS_HINT_EXPAND, 0.0);
  sc->setAlignHintSize (EVAS_HINT_FILL, EVAS_HINT_FILL);
  bx->packEnd (*sc);

  en = Entry::factory (*win);
  en->setPassword (true);
  en->setText ("Password here");
  en->setWeightHintSize (EVAS_HINT_EXPAND, 0.0);
  en->setAlignHintSize (EVAS_HINT_FILL, 0.0);
  en->selectAll ();
  sc->setContent (*en);
  en->show ();

  sc->show ();

  sc = Scroller::factory (*win);
  sc->setWeightHintSize (EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  sc->setAlignHintSize (EVAS_HINT_FILL, EVAS_HINT_FILL);
  sc->setPolicy (ELM_SCROLLER_POLICY_ON, ELM_SCROLLER_POLICY_ON);
  bx->packEnd (*sc);

  en = Entry::factory (*win);
  en->setText ("This is an entry widget in this window that<br>"
               "uses markup <b>like this</> for styling and<br>"
               "formatting <em>like this</>, as well as<br>"
               "<a href=X><link>links in the text</></a>, so enter text<br>"
               "in here to edit it. By the way, links are<br>"
               "called <a href=anc-02>Anchors</a> so you will need<br>"
               "to refer to them this way. At the end here is a really long line to test line wrapping to see if it works. But just in case this line is not long enough I will add more here to really test it out, as Elementary really needs some good testing to see if entry widgets work as advertised.");

  en->setWeightHintSize (EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  en->setAlignHintSize (EVAS_HINT_FILL, EVAS_HINT_FILL);
  sc->setContent (*en);
  en->show ();

  sc->show ();

  Box *bx2 = Box::factory (*win);
  bx2->setOrientation (Box::Horizontal);
  bx2->setWeightHintSize (EVAS_HINT_EXPAND, 0.0);
  bx2->setAlignHintSize (EVAS_HINT_FILL, EVAS_HINT_FILL);


  bt = Button::factory (*win);
  bt->setLabel ("Clear");
  bt->getEventSignal ("clicked")->connect (sigc::bind (sigc::ptr_fun (&my_entry_bt_1), en));
  bt->setAlignHintSize (EVAS_HINT_FILL, EVAS_HINT_FILL);
  bt->setWeightHintSize (EVAS_HINT_EXPAND, 0.0);
  bx2->packEnd (*bt);
  bt->show ();

  bt = Button::factory (*win);
  bt->setLabel ("Print");
  bt->getEventSignal ("clicked")->connect (sigc::bind (sigc::ptr_fun (&my_entry_bt_2), en));
  bt->setAlignHintSize (EVAS_HINT_FILL, EVAS_HINT_FILL);
  bt->setWeightHintSize (EVAS_HINT_EXPAND, 0.0);
  bx2->packEnd (*bt);
  bt->show ();

  bt = Button::factory (*win);
  bt->setLabel ("Selection");
  bt->getEventSignal ("clicked")->connect (sigc::bind (sigc::ptr_fun (&my_entry_bt_3), en));
  bt->setAlignHintSize (EVAS_HINT_FILL, EVAS_HINT_FILL);
  bt->setWeightHintSize (EVAS_HINT_EXPAND, 0.0);
  bx2->packEnd (*bt);
  bt->show ();

  bt = Button::factory (*win);
  bt->setLabel ("Insert");
  bt->getEventSignal ("clicked")->connect (sigc::bind (sigc::ptr_fun (&my_entry_bt_4), en));
  bt->setAlignHintSize (EVAS_HINT_FILL, EVAS_HINT_FILL);
  bt->setWeightHintSize (EVAS_HINT_EXPAND, 0.0);
  bx2->packEnd (*bt);
  bt->show ();

  bx->packEnd (*bx2);
  bx2->show ();

  win->resize (size320x320);

  win->setFocus (true);
  win->show ();
}
示例#2
0
文件: main.cpp 项目: Limsik/e17
int main (int argc, char **argv)
{
  Application elmApp (argc, argv);

  Window *elmWin = Window::factory ("window1", ELM_WIN_BASIC);
  elmWin->getEventSignal ("delete,request")->connect (sigc::ptr_fun (&my_win_del));

  Background *bg = Background::factory (*elmWin);

  //Evas *e = evas_object_evas_get(bg->obj ());

/*  Evasxx::Canvas ec (e);

  Evasxx::Image ei (ec);
  ei.setFile (searchPixmapFile ("elementaryxx/plant_01.jpg"));
  ei.setGeometry (Rect (100,100, 100, 100));
  ei.show ();*/

  Button *elmButton = Button::factory (*elmWin);
  Clock *elmClock = Clock::factory (*elmWin);
  //elmWin->addMember (ei);
  //Toggle *elmToggle = Toggle::factory (*elmWin);
  Scroller *elmScroller = Scroller::factory (*elmWin);
  Entry *elmEntry = Entry::factory (*elmWin);
  Slider *elmSlider = Slider::factory (*elmWin);

  bg->setWeightHintSize (1.0, 1.0);
  elmWin->addObjectResize (*bg);

  /* set size hints. a minimum size for the bg. this should propagate back
   * to the window thus limiting its size based off the bg as the bg is one
   * of the window's resize objects. */
  bg->setMinHintSize (Size (160, 160));
  /* and set a maximum size. not needed very often. normally used together
   * with evas_object_size_hint_min_set() at the same size to make a
   * window not resizable */
  bg->setMaxHintSize (Size (640, 640));

  elmWin->resize (Size (500, 500));
  elmButton->resize (Size (100, 50));
  elmClock->setGeometry (Rect (100, 50, 200, 50));
  //elmToggle->setGeometry (Rect (150, 80, 100, 50));
  elmScroller->setGeometry (Rect (250, 120, 200, 200));
  elmEntry->setGeometry (Rect (150, 200, 100, 50));
  elmSlider->setGeometry (Rect (200, 200, 100, 50));

  elmWin->setTitle ("Elementaryxx Simple Example");

  elmButton->setText ("Text");

  elmClock->setEdit (true);

  elmWin->setAutoDel (true);

  //elmToggle->getEventSignal ("sub-object-del")->connect (sigc::ptr_fun (&testFunc));

  elmWin->show ();
  bg->show ();
  elmButton->show ();
  elmClock->show ();
  //elmToggle->show ();
  elmScroller->show ();
  elmEntry->show ();
  elmSlider->show ();

  elmApp.run ();
}