source: tags/arb-6.0/AWT/AWT_modules.cxx

Last change on this file was 9786, checked in by westram, 11 years ago
  • fix resource-checker
    • xpm changes
    • detect calls
      • in member-init-list
      • as param to other call
    • ignore non-resource files in 'genhelp'
  • added/updated hints for undectected resource-usage (uses_…_res())
  • changed some comments confusing the resource-checker
File size: 3.2 KB
Line 
1// ============================================================= //
2//                                                               //
3//   File      : AWT_modules.cxx                                 //
4//   Purpose   :                                                 //
5//                                                               //
6//   Coded by Ralf Westram (coder@reallysoft.de) in April 2012   //
7//   Institute of Microbiology (Technical University Munich)     //
8//   http://www.arb-home.de/                                     //
9//                                                               //
10// ============================================================= //
11
12#include "awt_modules.hxx"
13#include <aw_window.hxx>
14
15#define awt_assert(cond) arb_assert(cond)
16
17void awt_create_order_buttons(AW_window *aws, awt_orderfun reorder_cb, AW_CL cl) {
18    // generates order buttons at current pos and binds them to 'reorder_cb'
19    // 'cl' is forwarded to reorder_cb
20
21    AW_at_auto auto_at;
22    auto_at.store(aws->_at);
23
24    aws->auto_space(1, 1);
25    aws->at_newline();
26
27    int x, y; aws->get_at_position(&x, &y);
28
29    aws->callback((AW_CB)reorder_cb, ARM_TOP, cl); aws->create_button("moveTop", "#moveTop.xpm", 0);
30
31    aws->at_newline();
32    int yoff = aws->get_at_yposition()-y;
33    awt_assert(yoff>0);
34
35    aws->at(x, y+1*yoff); aws->callback((AW_CB)reorder_cb, ARM_UP,     cl); aws->create_button("moveUp",     "#moveUp.xpm",     0);
36    aws->at(x, y+2*yoff); aws->callback((AW_CB)reorder_cb, ARM_DOWN,   cl); aws->create_button("moveDown",   "#moveDown.xpm",   0);
37    aws->at(x, y+3*yoff); aws->callback((AW_CB)reorder_cb, ARM_BOTTOM, cl); aws->create_button("moveBottom", "#moveBottom.xpm", 0);
38
39    auto_at.restore(aws->_at);
40}
41
42inline const char *bitmap_name(bool rightwards, bool all) {
43    if (all) return rightwards ? "#moveAllRight.xpm" : "#moveAllLeft.xpm"; // uses_pix_res("moveAllRight.xpm", "moveAllLeft.xpm");
44    return rightwards ? "#moveRight.xpm" : "#moveLeft.xpm";                // uses_pix_res("moveRight.xpm", "moveLeft.xpm"); see ../SOURCE_TOOLS/check_ressources.pl@uses_pix_res
45}
46
47void awt_create_collect_buttons(AW_window *aws, bool collect_rightwards, awt_collectfun collect_cb, AW_CL cl) {
48    // generates collect buttons at current pos and binds them to 'collect_cb'
49    // 'cl' is forwarded to 'collect_cb'
50    // 'collect_rightwards' affects the direction of the buttons
51
52    AW_at_auto auto_at;
53    auto_at.store(aws->_at);
54
55    aws->auto_space(1, 1);
56    aws->button_length(0);
57    aws->at_newline();
58
59    int x, y; aws->get_at_position(&x, &y);
60
61    bool       collect = collect_rightwards;
62    const bool all     = true;
63
64    aws->callback((AW_CB)collect_cb, ACM_FILL, cl); aws->create_button("ADDALL", bitmap_name(collect, all), 0);
65
66    aws->at_newline();
67    int yoff = aws->get_at_yposition()-y;
68    awt_assert(yoff>0);
69
70    aws->at(x, y+1*yoff); aws->callback((AW_CB)collect_cb, ACM_ADD,    cl); aws->create_button("ADD",    bitmap_name(collect,  !all), 0);
71    aws->at(x, y+2*yoff); aws->callback((AW_CB)collect_cb, ARM_DOWN,   cl); aws->create_button("REMOVE", bitmap_name(!collect, !all), 0);
72    aws->at(x, y+3*yoff); aws->callback((AW_CB)collect_cb, ARM_BOTTOM, cl); aws->create_button("CLEAR",  bitmap_name(!collect, all),  0);
73
74    auto_at.restore(aws->_at);
75}
Note: See TracBrowser for help on using the repository browser.