Opened 14 years ago

Closed 10 years ago

#239 closed enhancement (inactive)

custom button sizes

Reported by: pabs Owned by: gogo
Priority: normal Milestone: 2.0
Component: Xinha Core Version: trunk
Severity: normal Keywords:
Cc:

Description

It would be nice to be able to create custom sized buttons and have them use the size of the images.

Attachments (1)

custom-button-sizes.patch (908 bytes) - added by pabs 14 years ago.
custom button size patch

Download all attachments as: .zip

Change History (7)

Changed 14 years ago by pabs

custom button size patch

comment:1 Changed 14 years ago by gogo

  • Version set to trunk

pabs: I don't think that's going to work, not with the combined images system at least.

comment:2 Changed 14 years ago by niko

should be closed(?)

whats the problem with fixed-sized images anyway?

comment:3 Changed 14 years ago by gogo

  • Milestone changed from Version 1.0 to 2.0

I think that people want to be able to have different sized images, I guess perhaps to have rectangular ones or something? Or perhaps to have bigger ones for people with poor eyesight, or smaller ones for people with superman eyesight.

I think though that this can wait. Changign the milstone.

comment:4 Changed 14 years ago by pabs3@…

In my case the buttons I wanted to use were 58 x 32, 109 x 32 and 87 x 32. The patch I attached allowed me to do this with the combined images. Sorry for not following up on this quickly, bug tracking systems without an email gateway are annoying.

comment:5 Changed 14 years ago by gocher

To do something you want to do, you have to set a variable for the size, then you must find all positions where the size is in use and that are more than you found. In the following function there are eight positions!

HTMLArea.makeBtnImg = function(imgDef, doc)
{
  if(!doc) doc = document;

  if(!doc._htmlareaImgCache)
  {
    doc._htmlareaImgCache = { };
  }
  
  var i_contain = doc.createElement('div');  
  i_contain.className    = 'buttonImageContainer';
  i_contain.style.position = 'relative';  
  i_contain.style.overflow = 'hidden';  
  i_contain.style.width = "18px";  
  i_contain.style.height = "18px";  
  
  var img = null;
  if(typeof imgDef == 'string')
  {
    if(doc._htmlareaImgCache[imgDef])
    {
      img = doc._htmlareaImgCache[imgDef].cloneNode();
    }
    else
    {
      img = doc.createElement("img");
      img.src = imgDef;
      img.style.width = "18px";
      img.style.height = "18px";
      if(use_clone_img)
        doc._htmlareaImgCache[imgDef] = img.cloneNode();
    }
  }
  else
  {
    if(doc._htmlareaImgCache[imgDef[0]])
    {
      img = doc._htmlareaImgCache[imgDef[0]].cloneNode();
    }
    else
    {
      img = doc.createElement("img");
      img.src = imgDef[0];
      img.style.position = 'relative';
      if(use_clone_img)
        doc._htmlareaImgCache[imgDef[0]] = img.cloneNode();
    }
    img.style.top  = imgDef[2] ? ('-' + (18 * (imgDef[2] + 1)) + 'px') : '-18px';
    img.style.left = imgDef[1] ? ('-' + (18 * (imgDef[1] + 1)) + 'px') : '-18px';
  }
  i_contain.appendChild(img);
  return i_contain;
}

comment:6 Changed 10 years ago by gogo

  • Resolution set to inactive
  • Status changed from new to closed

Inactive, closing. Maybe this can be done with skins in this modern age?

Note: See TracTickets for help on using tickets.